httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cove...@apache.org
Subject svn commit: r1523387 - in /httpd/httpd/trunk: CHANGES server/mpm/winnt/child.c
Date Sun, 15 Sep 2013 02:25:32 GMT
Author: covener
Date: Sun Sep 15 02:25:32 2013
New Revision: 1523387

URL: http://svn.apache.org/r1523387
Log:
In 2.4, the MPM leaves a copy of the non-disconnected FD sitting in
context->accept_socket. This FD will be closed a second time, often
shortly after a worker picks it up in this same FD being reused.  The
first recv fails with WSAENOTSOCK since the same FD was closed in the
listener thread while the worker was pulling it off the queue

(The second close is of the underlying FD/socket, not a shared
apr_socket_t, so it's not short-circuited)

This patch makes it a bit more 2.2.x-ish and solves my problem -- the
context->accept_socket gets zapped at the bottom of the loop if
!disconnected.


Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/server/mpm/winnt/child.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1523387&r1=1523386&r2=1523387&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Sun Sep 15 02:25:32 2013
@@ -1,6 +1,10 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) WinNT MPM: If ap_run_pre_connection() fails or sets c->aborted, don't
+     save the socket for reuse by the next worker as if it were an 
+     APR_SO_DISCONNECTED socket. Restores 2.2 behavior. [Eric Covener]
+
   *) mod_auth_digest: Be more specific when the realm mismatches because the
      realm has not been specified. [Graham Leggett]
 

Modified: httpd/httpd/trunk/server/mpm/winnt/child.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/winnt/child.c?rev=1523387&r1=1523386&r2=1523387&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/winnt/child.c (original)
+++ httpd/httpd/trunk/server/mpm/winnt/child.c Sun Sep 15 02:25:32 2013
@@ -878,12 +878,13 @@ static DWORD __stdcall worker_main(void 
 
         if (!c->aborted) {
             ap_run_process_connection(c);
+        }
 
-            apr_socket_opt_get(context->sock, APR_SO_DISCONNECTED,
-                               &disconnected);
+        apr_socket_opt_get(context->sock, APR_SO_DISCONNECTED, &disconnected);
 
-            if (!disconnected) {
-                context->accept_socket = INVALID_SOCKET;
+        if (!disconnected) {
+            context->accept_socket = INVALID_SOCKET;
+            if (!c->aborted) { 
                 ap_lingering_close(c);
             }
         }



Mime
View raw message