Summary: | Prefork MPM tries to accept on closed listener sockets during graceful restarts | ||
---|---|---|---|
Product: | Apache httpd-2 | Reporter: | John Lightsey <jd> |
Component: | mpm_prefork | Assignee: | Apache HTTPD Bugs Mailing List <bugs> |
Status: | RESOLVED LATER | ||
Severity: | normal | CC: | jd, takashi.asfbugzilla, teppo-dev |
Priority: | P2 | Keywords: | MassUpdate |
Version: | 2.2.15 | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Linux |
Description
John Lightsey
2010-04-06 19:33:47 UTC
Actually, putting the check before "goto got_fd" just tightens the race condition. unixd_accept() should probably check if the server is shutting down when it fails and not log an error in this case. trunk has code for this situation, though it is only enabled for a certain Fujitsu mainframe platform. Here is a patch for 2.2.x. Does this resolve the error message for you? Index: os/unix/unixd.c =================================================================== --- os/unix/unixd.c (revision 923736) +++ os/unix/unixd.c (working copy) @@ -633,6 +633,12 @@ return APR_EGENERAL; #else default: + /* If the socket has been closed in ap_close_listeners() + * by the restart/stop action, we may get EBADF. + * Do not print an error in this case. + */ + if (!lr->active && status == EBADF) + return status; ap_log_error(APLOG_MARK, APLOG_ERR, status, ap_server_conf, "apr_socket_accept: (client socket)"); return APR_EGENERAL; Yes, that works perfectly. Here's an updated 2.2.x patch based on what I committed to trunk: Index: os/unix/unixd.c =================================================================== --- os/unix/unixd.c (revision 933664) +++ os/unix/unixd.c (working copy) @@ -633,6 +633,15 @@ return APR_EGENERAL; #else default: + /* If the socket has been closed in ap_close_listeners() + * by the restart/stop action, we may get EBADF. + * Do not print an error in this case. + */ + if (!lr->active) { + ap_log_error(APLOG_MARK, APLOG_DEBUG, status, ap_server_conf, + "apr_socket_accept failed for inactive listener"); + return status; + } ap_log_error(APLOG_MARK, APLOG_ERR, status, ap_server_conf, "apr_socket_accept: (client socket)"); return APR_EGENERAL; It can be noisier than the previous patch, as it writes a message at log level debug. Please help us to refine our list of open and current defects; this is a mass update of old and inactive Bugzilla reports which reflect user error, already resolved defects, and still-existing defects in httpd. As repeatedly announced, the Apache HTTP Server Project has discontinued all development and patch review of the 2.2.x series of releases. The final release 2.2.34 was published in July 2017, and no further evaluation of bug reports or security risks will be considered or published for 2.2.x releases. All reports older than 2.4.x have been updated to status RESOLVED/LATER; no further action is expected unless the report still applies to a current version of httpd. If your report represented a question or confusion about how to use an httpd feature, an unexpected server behavior, problems building or installing httpd, or working with an external component (a third party module, browser etc.) we ask you to start by bringing your question to the User Support and Discussion mailing list, see [https://httpd.apache.org/lists.html#http-users] for details. Include a link to this Bugzilla report for completeness with your question. If your report was clearly a defect in httpd or a feature request, we ask that you retest using a modern httpd release (2.4.33 or later) released in the past year. If it can be reproduced, please reopen this bug and change the Version field above to the httpd version you have reconfirmed with. Your help in identifying defects or enhancements still applicable to the current httpd server software release is greatly appreciated. |