]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
In 2.4, the MPM leaves a copy of the non-disconnected FD sitting in
authorEric Covener <covener@apache.org>
Sun, 15 Sep 2013 02:25:32 +0000 (02:25 +0000)
committerEric Covener <covener@apache.org>
Sun, 15 Sep 2013 02:25:32 +0000 (02:25 +0000)
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.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1523387 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
server/mpm/winnt/child.c

diff --git a/CHANGES b/CHANGES
index 3d674a82c897ca265a01952fcbd41c7fda33c4dd..e8465d646a63b72c4e60d02888244ec6dd12bfa2 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -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]
 
index b62fabdaae70597444eadf1c8962d7fab20917b6..cb37fc9f3aeb8a8010d10929facf9957e1d874c6 100644 (file)
@@ -878,12 +878,13 @@ static DWORD __stdcall worker_main(void *thread_num_val)
 
         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);
             }
         }