You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Brian Tao <ta...@nbc.netcom.ca> on 1997/04/25 22:48:32 UTC

$#%@#! Solaris 2.5.1 and fd problem FAQ

    I know this has probably been answered a billion times before, so
if someone could point me towards an archive for this list, I'll just
look there.  ;-)

    I'm bumping into what appears to be a limit of 255 open files
under Solaris 2.5.1.  FD_SETSIZE is 1024, and I've increased the
number of fd's as suggested by the Solaris 2.x FAQ to 1024/4096
(current/max).  The fdopen() man page suggests that FD_SETSIZE is
irrelevant, and that Solaris is only capable of handling a filedes
argument of 255 or less.  This seems ridiculous for an OS that is
touted as an Internet platform, so I thought I'd ask for a sanity
check here.  Is there any way to have Solaris open more than 255 files
at a time per process?  I'm getting this error:

fopen: Error 0
httpd: could not log pid to file /www/logs/httpd.pid

    I know I can reconfigure Apache's logging to save everything to a
single file, and then split them later, but that's not an option that
is immediately available (part of the service offering is separate CLF
access_log and error_log for each customer).  Running more than one
Apache with separate httpd.conf's is also not an option right now.  My
bandaid right now is commenting out the TransferLog and ErrorLog
directives of virtual hosts that aren't active yet.
-- 
Brian Tao (BT300, taob@netcom.ca)
"Though this be madness, yet there is method in't"


Re: $#%@#! Solaris 2.5.1 and fd problem FAQ

Posted by Dean Gaudet <dg...@arctic.org>.
It is a limitation of FILE *, and probably some C library functions under
solaris.  But FILE * is the largest problem with it.  Sun has never said
they would fix it... because fixing it breaks binary compatibility.

We've proposed a bunch of fixes.  Including the obvious: don't use stdio.
You could try linking against sfio in stdio compatibility mode.  If that's
not an option you're kind of stuck.  But you could add this to util.c:


int get_high_fd (int fd)
{
    int high_fd;

    if (fd >= 256) {
	return fd;
    }
    high_fd = fcntl (fd, F_DUPFD, 256);
    if (high_fd == -1) {
	return fd;
    }
    close (fd);
    return high_fd;
}

And then after every socket(), and open() call (which aren't fdopen()d later)
just go fd = get_high_fd (fd);.

That'll leave the arena < 256 available for fopens.

Dean

On Fri, 25 Apr 1997, Brian Tao wrote:
>     I'm bumping into what appears to be a limit of 255 open files
> under Solaris 2.5.1.