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

[ID 19991124.010] Perl incorrectly limits maxmimum number of openfiles

Thread Next
From:
Yossi Klein
Date:
November 24, 1999 23:09
Subject:
[ID 19991124.010] Perl incorrectly limits maxmimum number of openfiles
Message ID:
199911250708.JAA26308@tree.alerts.co.il

This is a bug report for perl from jklein@alerts.co.il,
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
time.

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,
Thanks,
Yossi Klein

---------------------

#!/usr/local/bin/perl

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";
	}

	$i++;
}




[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:
  Platform:
    osname=solaris, osvers=2.4, archname=sun4-solaris
    uname='sunos abel.alerts.co.il 5.4 generic_101945-41 sun4m sparc '
    hint=recommended, useposix=true, d_sigaction=define
    bincompat3=y useperlio=undef d_sfio=undef
  Compiler:
    cc='cc', optimize='-O', gccversion=
    cppflags='-I/usr/local/include'
    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/libc.so, 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:
	/usr/local/lib/perl5/sun4-solaris/5.00404
	/usr/local/lib/perl5
	/usr/local/lib/perl5/site_perl/sun4-solaris
	/usr/local/lib/perl5/site_perl
	/usr/local/lib/perl5/sun4-solaris
	.

---
Environment for perl 5.00404:
    HOME=/home/jklein
    LANG=en_US
    LC_COLLATE=en_US
    LC_CTYPE=en_US
    LC_MESSAGES=C
    LC_MONETARY=en_US
    LC_NUMERIC=en_US
    LC_TIME=en_US
    LD_LIBRARY_PATH=/usr/lib:/usr/dt/lib:/usr/ccs/lib:/opt/SUNWmotif/lib:/usr/openwin/lib:/opt/pure/cache/usr/lib:/home/jklein/rvplayer5.0:/news3.0/lib:/news3.0/sun7/lib
    LOGDIR (unset)
    PATH=/home/jklein/bin:/usr/local/bin:/usr/local/etc:/usr/lib/lp/postscript:/usr/lib/nis:/opt/gnu/bin:/bin:/usr/bin:/usr/ccs/bin:/usr/sbin:/opt/SUNWconn/bin:/opt/SUNWmotif/bin:/usr/openwin/bin:/usr/openwin/demo:/usr/bin/X11:/opt/SUNWspro/bin:/etc:/usr/etc:/usr/hosts:.:/usr/lang:/bin:/usr/bin:/usr/5bin:/usr/local/sybase/bin:/usr/snm/bin:/usr/local/frame/bin:/home/ddts/bin:/tools/java/bin:/opt/oracle7/bin:/opt/webalert/etc:/home/jklein/rvplayer5.0:/news3.0/bin:/news3.0/sun7/bin:/opt/news/bin
    PERL_BADLANG (unset)
    SHELL=/bin/ksh

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About