develooper Front page | perl.perl5.porters | Postings from November 1999

[ID 19991124.010] Perl incorrectly limits maxmimum number of openfiles

Thread Next
Yossi Klein
November 24, 1999 23:09
[ID 19991124.010] Perl incorrectly limits maxmimum number of openfiles
Message ID:

This is a bug report for perl from,
generated with the help of perlbug 1.20 running under perl 5.00404.

[Please enter your report here]

I'm working on a Solaris machine, and using ulimit, I upped the maximum
number of file descriptors to 700. I then ran a test program using open
and found that open() will only allow me to have up to 256 files open at a

Okay, I thought "Perl open() is based on C's fopen() which only supports
fds up to 255".

So I tried FileHandle and found that it also failed above 256; I can live
with that.

With supreme confidence, I decided to run the test with sysopen. Imagine
my surprise when I found that still only 256 open fds were supported!!!

This seems to me to be a major bug. I searched the archives and looked
through the perlfaq, but there is no reference to this anywhere. Is this a
real problem or am I missing something very obvious?

PS I ran my program using truss and verified that the system call open()s
were succeeding and that Perl was deciding to fail the Perl sysopen()
call nonetheless.

Below is the program that I used to test this. The 3 open() lines are
mutually exclusive - ie. only uncomment one at a time.

Any help would be greatly appreciated,
Yossi Klein



use FileHandle;
use Fcntl;

$i = 0;
while ($i < 350)
	$fd = "fd$i";
	$fname = '/dev/null';

	#$rc = open ($fd, "<$fname");

	#$rc = ($ffh[$i] = new FileHandle)->open($fname, "r");

	#$rc = sysopen($fd, $fname, O_RDONLY);

	if (!$rc)
		die "open $i failed\n";


[Please do not change anything below this line]

Site configuration information for perl 5.00404:

Configured by jklein at Tue Dec 16 11:37:16 IST 1997.

Summary of my perl5 (5.0 patchlevel 4 subversion 4) configuration:
    osname=solaris, osvers=2.4, archname=sun4-solaris
    uname='sunos 5.4 generic_101945-41 sun4m sparc '
    hint=recommended, useposix=true, d_sigaction=define
    bincompat3=y useperlio=undef d_sfio=undef
    cc='cc', optimize='-O', gccversion=
    ccflags ='-I/usr/local/include'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    voidflags=15, castflags=0, d_casti32=define, d_castneg=define
    intsize=4, alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib -L/opt/gnu/lib'
    libpth=/usr/local/lib /opt/gnu/lib /lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -ldb -ldl -lm -lc -lcrypt
    libc=/lib/, so=so
    useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-Kpic', lddlflags='-G -L/usr/local/lib -L/opt/gnu/lib'

Locally applied patches:

@INC for perl 5.00404:

Environment for perl 5.00404:
    LOGDIR (unset)
    PERL_BADLANG (unset)

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About