From owner-freebsd-questions@freebsd.org Wed May 9 14:39:35 2018 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 025FCFBEB34 for ; Wed, 9 May 2018 14:39:35 +0000 (UTC) (envelope-from guru@unixarea.de) Received: from smh-06.1blu.de (smh-06.1blu.de [178.254.0.206]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 96C8673779 for ; Wed, 9 May 2018 14:39:34 +0000 (UTC) (envelope-from guru@unixarea.de) Received: from [172.16.29.5] (helo=sh4-5.1blu.de) by smh-06.1blu.de with esmtp (Exim 4.86_2) (envelope-from ) id 1fGQFf-0003qt-Vm for freebsd-questions@freebsd.org; Wed, 09 May 2018 16:39:32 +0200 Received: from ftp51246-2575596 by sh4-5.1blu.de with local (Exim 4.86_2) (envelope-from ) id 1fGQFf-00076v-U1 for freebsd-questions@freebsd.org; Wed, 09 May 2018 16:39:31 +0200 Date: Wed, 9 May 2018 16:39:31 +0200 From: Matthias Apitz To: freebsd-questions@freebsd.org Subject: Re: Problem with screen Message-ID: <20180509143931.GA14210@sh4-5.1blu.de> Reply-To: Matthias Apitz Mail-Followup-To: freebsd-questions@freebsd.org References: <20180509134456.GA13314@io.chezmoi.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180509134456.GA13314@io.chezmoi.fr> X-Operating-System: FreeBSD 12.0-CURRENT r314251 (amd64) X-message-flag: Mails containing HTML will not be read! Please send only plain text. User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2018 14:39:35 -0000 El día Wednesday, May 09, 2018 a las 03:44:56PM +0200, Albert Shih escribió: > Hi, > > I've got a freebsd 11.1-RELEASE-p6 on bare-metal and I've got a very > strange problem. > > When I launch screen it's take very long time to create a screen. > > So I try truss screen, in a typescript, and I got > > close(11285153) ERR#9 'Bad file descriptor' > close(11285152) ERR#9 'Bad file descriptor' > .............. > close(1) ERR#9 'Bad file descriptor' > > between those I got > > 11285150 lines of > > close(....) ERR#9 'Bad file descriptor' > > Everything are up2date on the server. > > Anyone got a idea ? I'd say a bug. It wants to close all possible filedescriptors, regardless if they're open or not, from some (wrong deduced) maximal value to 1. I checked out the port and modified the function closing the files in misc.c: void closeallfiles(except) int except; { int f; #ifdef SVR4 struct rlimit rl; if ((getrlimit(RLIMIT_NOFILE, &rl) == 0) && rl.rlim_max != RLIM_INFINITY) { f = rl.rlim_max; printf("1: closeallfiles: %d\n", f); } else #endif /* SVR4 */ #if defined(SYSV) && defined(NOFILE) && !defined(ISC) f = NOFILE; printf("2: closeallfiles: %d\n", f); #else /* SYSV && !ISC */ f = getdtablesize(); printf("3: closeallfiles: %d\n", f); #endif /* SYSV && !ISC */ printf("closeallfiles: %d\n", f); exit(1); while (--f > 2) if (f != except) close(f); } it prints: ./screen 1: closeallfiles: 116973 3: closeallfiles: 116973 closeallfiles: 116973 So you see where the bug comes from ... matthias -- Matthias Apitz, ✉ guru@unixarea.de, ⌂ http://www.unixarea.de/ 📱 +49-176-38902045 Public GnuPG key: http://www.unixarea.de/key.pub