On Wed, Sep 11, 2002 at 09:21:09AM +0200, Craig Kaes via RT wrote:
> OPEN_MAX, the max # of fds allowable to me is honored by fopen and on
> BSD and Gnu this value tracks ulimit values. On Solaris, tho, it
> appears hard coded. To wit:
>
> [craigk:~/tmp/fopen]$ cat foo.c
> #include <stdio.h>
> #include <errno.h>
>
> int main()
> {
> int i = 0;
> while (fopen("/etc/passwd", "r"))
> {
> i++;
> }
> fprintf(stderr, "Made it %d times. Errno %d (%s)\n", i, errno,
> strerror(errno));
> }
> [craigk:~/tmp/fopen]$ ulimit -n
> 16384
> [craigk:~/tmp/fopen]$ ./foo
> Made it 253 times. Errno 24 (Too many open files)
> [craigk:~/tmp/fopen]$ uname -a
> SunOS dev3 5.8 Generic_108528-15 sun4u sparc SUNW,Ultra-60
>
> Errored out at 253 + stdin + stdout + stderr = 256. How do I work
> around this issue without rewriting all the BIO stuff to use
> open/read/write/etc.? Have others encountered and solved this problem?
> Both the multiplexor and the little fopen test program work the way
> I'd like them to work on Linux.
The "Too many open files" issue is caused by a table limit to the number
of open files. It does not matter whether you are using buffered (stdio.h:
fopen, fread, ...) or unbuffered (io.h: open, read, ...) I/O is used.
Depending on the system, the corresponding table sizes are the number
of file descriptors per process and for the overall system, which
may be generous (Linux defaults to 1024) or small (HP-UX 10.20 defaults
to 70(?)). Linux allows even to dynamically extend this value, if
memory serves me right. On HP-UX these table sizes are kernel settings.
One has to change the settings and recompile the kernel (and reboot).
I don't know how this is handled under Solaris.
Please also note, that several processes rely on "select()", which
may require special handling once the number of open file descriptors
exceeds FD_SETSIZE.
This is no problem of OpenSSL but of your system setup. I will therefore
close this ticket.
Best regards,
Lutz
--
Lutz Jaenicke [EMAIL PROTECTED]
http://www.aet.TU-Cottbus.DE/personen/jaenicke/
BTU Cottbus, Allgemeine Elektrotechnik
Universitaetsplatz 3-4, D-03044 Cottbus
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]