You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2003/08/28 22:09:29 UTC

DO NOT REPLY [Bug 22805] New: - file descriptors are erroneously closed

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22805>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22805

file descriptors are erroneously closed

           Summary: file descriptors are erroneously closed
           Product: Apache httpd-1.3
           Version: 1.3.28
          Platform: PC
               URL: http://mathforum.org/epigone/modperl-
                    dev/pheiholcla/20030827.192821.82882467.radu@primIT.ro
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: core
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: rgreab@fx.ro


In the message available at the mentioned URL, I describe a bug in Apache that
sometimes blocks Bricolage, a mod_perl application.

The bug is caused by the recent work of adding proactive close functions to
prevent file descriptors leaking to the child processes. Basically, in
http_main.c, some calls of ap_note_cleanups_for_fd() were replaced with calls to
ap_note_cleanups_for_socket_ex(), but ap_bclose() still calls ap_pclosef() which
disarms the cleanup for files, not for sockets. Later, the cleanup for socket is
invoked because it was not disabled and closes for the second time a file
descriptor which may be already closed (no harm) or may be in use by someone
else (the Bricolage problem).

I'm proposing a patch that:
- in buff.c: modifies ap_bclose() so that on all platforms ap_pclosesocket() is
called for sockets and ap_closef() is called for files;
- in http_main.c:
  - disarms a cleanup before ap_slack() because ap_slack() closes the socket 
    itself
  - changes the level to critical for the error message issued when the fd_sets 
    test fails
  - removes a kill_cleanup before ap_bclose() because it is redundant

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org