Discussion:
Problem with screen
(too old to reply)
Albert Shih
2018-05-09 13:44:56 UTC
Permalink
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 ?

Regards

JAS
--
Albert SHIH
DIO bâtiment 15
Observatoire de Paris
xmpp: ***@obspm.fr
Heure local/Local time:
Wed May 9 15:39:14 CEST 2018
Matthias Apitz
2018-05-09 14:39:31 UTC
Permalink
Post by Albert Shih
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, ✉ ***@unixarea.de, ⌂ http://www.unixarea.de/ 📱 +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub
Continue reading on narkive:
Loading...