Date: Wed, 9 May 2018 16:39:31 +0200 From: Matthias Apitz <guru@unixarea.de> To: freebsd-questions@freebsd.org Subject: Re: Problem with screen Message-ID: <20180509143931.GA14210@sh4-5.1blu.de> In-Reply-To: <20180509134456.GA13314@io.chezmoi.fr> References: <20180509134456.GA13314@io.chezmoi.fr>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180509143931.GA14210>
