You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Axel Beckert <ax...@dagstuhl.de> on 2002/01/13 19:04:16 UTC

config/9467: Soft limit of open file descriptors (uname -Sn) increases by 2 (per VHost) after each restart or graceful restart

>Number:         9467
>Category:       config
>Synopsis:       Soft limit of open file descriptors (uname -Sn) increases by 2 (per VHost) after each restart or graceful restart
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    apache
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Sun Jan 13 10:10:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     axel@dagstuhl.de
>Release:        1.3.22
>Organization:
apache
>Environment:
SunOS 5.7 Generic sun4u sparc (aka Solaris 7)
gcc version 2.95.2 19991024 (release)
>Description:
Due to having problems with too many open files, I wrote a SSI page including '<!--#exec cmd="/bin/ulimit -Sn" -->'. I wrote a wrapper around apachectl which sets the soft limit of file descriptors (uname -Sn) to 512. If I request the above mentioned page after starting the Apache, the above SSI command returns 532 (and not 512), although I have only 5 VHosts. (Is ap_init_virtual_host called twice per VHost on starting?)

If I do an 'apachectl restart' or an 'apachectl graceful', it returns 542. And it increases by 10 (Seems as if I have 5 VHosts ;-) after each restart (equal if graceful or not). Only an 'apachectl stop' with an following 'apachectl start' resets the value to 532.

This doesn't happen if I set the soft limit to the hard limit, although  I haven't found the error message "Cannot exceed hard limit for open files" (which ap_init_virtual_host should generate in that case), anywhere, neither in the error_log nor on STDERR of my console.
>How-To-Repeat:

>Fix:
The problem is probably ap_init_virtual_host in http_config.c, where in line 1406 ("limits.rlim_cur += 2") the limit is increased by 2 for each VHost . So probably the soft limit of open files should be saved at a real start and be resetted to that value on each restart before ap_init_virtual_host is called for each VHost.

BTW: It would also be nice to set the soft limit of open files via some Apache configuration directive, perhaps RLimitNOFILE. This probably would solve the problem, too, if the directive is evaluated before ap_init_virtual_host is called.
>Release-Note:
>Audit-Trail:
>Unformatted:
 [In order for any reply to be added to the PR database, you need]
 [to include <ap...@Apache.Org> in the Cc line and make sure the]
 [subject line starts with the report component and number, with ]
 [or without any 'Re:' prefixes (such as "general/1098:" or      ]
 ["Re: general/1098:").  If the subject doesn't match this       ]
 [pattern, your message will be misfiled and ignored.  The       ]
 ["apbugs" address is not added to the Cc line of messages from  ]
 [the database automatically because of the potential for mail   ]
 [loops.  If you do not include this Cc, your reply may be ig-   ]
 [nored unless you are responding to an explicit request from a  ]
 [developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]