You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by pq...@apache.org on 2006/04/22 03:33:45 UTC

svn commit: r396049 - in /httpd/httpd/branches/2.2.x: CHANGES STATUS include/ap_mmn.h modules/proxy/mod_proxy.h modules/proxy/mod_proxy_http.c modules/proxy/proxy_util.c

Author: pquerna
Date: Fri Apr 21 18:33:44 2006
New Revision: 396049

URL: http://svn.apache.org/viewcvs?rev=396049&view=rev
Log:
Merge r394088 and r395180 from trunk.
PR: 38793
Reviewed By: rpluem, jim, wrowe, trawick

Modified:
    httpd/httpd/branches/2.2.x/CHANGES
    httpd/httpd/branches/2.2.x/STATUS
    httpd/httpd/branches/2.2.x/include/ap_mmn.h
    httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.h
    httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy_http.c
    httpd/httpd/branches/2.2.x/modules/proxy/proxy_util.c

Modified: httpd/httpd/branches/2.2.x/CHANGES
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.2.x/CHANGES?rev=396049&r1=396048&r2=396049&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.2.x/CHANGES [utf-8] Fri Apr 21 18:33:44 2006
@@ -4,6 +4,9 @@
   *) mod_deflate: work correctly in an internal redirect
      [Brian J. France <list firehawksystems com>]
 
+  *) mod_proxy: Do not release connections from connection pool twice.
+     PR 38793. [Ruediger Pluem, matthias <mk-asf gigacodes.de>]
+
   *) core: Prevent reading uninitialized memory while reading a line of
      protocol input.  PR 39282. [Davi Arnaut <davi haxent.com.br>]
 

Modified: httpd/httpd/branches/2.2.x/STATUS
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.2.x/STATUS?rev=396049&r1=396048&r2=396049&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/STATUS (original)
+++ httpd/httpd/branches/2.2.x/STATUS Fri Apr 21 18:33:44 2006
@@ -75,17 +75,6 @@
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-    * mod_proxy: Do not release connections from connection pool twice as this
-                 can cause different threads to use the same connection at the
-                 same time. PR 38793.
-        Trunk version of patch:
-          http://svn.apache.org/viewcvs?rev=394088&view=rev
-        2.2.x version of patch:
-          Trunk version works
-      +1: rpluem, jim, wrowe (with trawick's observation),
-          trawick (with rev 395180)
-      trawick: needs http://svn.apache.org/viewcvs?rev=395180&view=rev
-
     * mod_proxy_balancer: Initialize local data structures for workers of a
                           balancer. PR 38227, PR 38267.
         Trunk version of patch:

Modified: httpd/httpd/branches/2.2.x/include/ap_mmn.h
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.2.x/include/ap_mmn.h?rev=396049&r1=396048&r2=396049&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/include/ap_mmn.h (original)
+++ httpd/httpd/branches/2.2.x/include/ap_mmn.h Fri Apr 21 18:33:44 2006
@@ -109,6 +109,7 @@
  * 20051115.0 (2.1.10-dev/2.2.0) add use_canonical_phys_port to core_dir_config
  * 20051115.1 (2.2.1)  flush_packets and flush_wait members added to
  *                         proxy_server (minor)
+ * 20051115.2 (2.2.2)  added inreslist member to proxy_conn_rec (minor)
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503232UL /* "AP22" */
@@ -116,7 +117,7 @@
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
 #define MODULE_MAGIC_NUMBER_MAJOR 20051115
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 1                     /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 2                     /* 0...n */
 
 /**
  * Determine if the server's current MODULE_MAGIC_NUMBER is at least a

Modified: httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.h
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.h?rev=396049&r1=396048&r2=396049&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.h (original)
+++ httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.h Fri Apr 21 18:33:44 2006
@@ -221,6 +221,9 @@
     int          close_on_recycle; /* Close the connection when returning to pool */
     proxy_worker *worker;   /* Connection pool this connection belogns to */
     void         *data;     /* per scheme connection data */
+#if APR_HAS_THREADS
+    int          inreslist; /* connection in apr_reslist? */
+#endif
 } proxy_conn_rec;
 
 typedef struct {

Modified: httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy_http.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy_http.c?rev=396049&r1=396048&r2=396049&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy_http.c (original)
+++ httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy_http.c Fri Apr 21 18:33:44 2006
@@ -1230,7 +1230,6 @@
             ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
                           "proxy: error reading status line from remote "
                           "server %s", backend->hostname);
-            ap_proxy_http_cleanup(NULL, r, backend);
             return ap_proxyerror(r, HTTP_BAD_GATEWAY,
                                  "Error reading from remote server");
         }
@@ -1251,7 +1250,6 @@
              * if the status line was > 8192 bytes
              */
             else if ((buffer[5] != '1') || (len >= sizeof(buffer)-1)) {
-                ap_proxy_http_cleanup(NULL, r, backend);
                 return ap_proxyerror(r, HTTP_BAD_GATEWAY,
                 apr_pstrcat(p, "Corrupt status line returned by remote "
                             "server: ", buffer, NULL));

Modified: httpd/httpd/branches/2.2.x/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.2.x/modules/proxy/proxy_util.c?rev=396049&r1=396048&r2=396049&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/branches/2.2.x/modules/proxy/proxy_util.c Fri Apr 21 18:33:44 2006
@@ -1515,7 +1515,18 @@
     if (!worker->cp)
         return APR_SUCCESS;
 
-    /* deterimine if the connection need to be closed */
+#if APR_HAS_THREADS
+    /* Sanity check: Did we already return the pooled connection? */
+    if (conn->inreslist) {
+        ap_log_perror(APLOG_MARK, APLOG_ERR, 0, conn->pool,
+                      "proxy: Pooled connection 0x%pp for worker %s has been"
+                      " already returned to the connection pool.", conn,
+                      worker->name);
+        return APR_SUCCESS;
+    }
+#endif
+
+    /* determine if the connection need to be closed */
     if (conn->close_on_recycle || conn->close) {
         apr_pool_t *p = conn->pool;
         apr_pool_clear(conn->pool);
@@ -1525,6 +1536,7 @@
     }
 #if APR_HAS_THREADS
     if (worker->hmax && worker->cp->res) {
+        conn->inreslist = 1;
         apr_reslist_release(worker->cp->res, (void *)conn);
     }
     else
@@ -1555,6 +1567,9 @@
 
     conn->pool   = ctx;
     conn->worker = worker;
+#if APR_HAS_THREADS
+    conn->inreslist = 1;
+#endif
     *resource = conn;
 
     return APR_SUCCESS;
@@ -1787,6 +1802,9 @@
     (*conn)->worker = worker;
     (*conn)->close  = 0;
     (*conn)->close_on_recycle = 0;
+#if APR_HAS_THREADS
+    (*conn)->inreslist = 0;
+#endif
 
     return OK;
 }