httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From minf...@apache.org
Subject svn commit: r1035605 - /httpd/httpd/trunk/modules/proxy/mod_proxy_http.c
Date Tue, 16 Nov 2010 12:08:38 GMT
Author: minfrin
Date: Tue Nov 16 12:08:38 2010
New Revision: 1035605

URL: http://svn.apache.org/viewvc?rev=1035605&view=rev
Log:
When the proxy closes the backend connection early, force a setaside on
any buckets still outstanding to ensure they've been copied out of the
backend connection's pool and it is safe to release the backend connection.

Modified:
    httpd/httpd/trunk/modules/proxy/mod_proxy_http.c

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_http.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_http.c?rev=1035605&r1=1035604&r2=1035605&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_http.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_http.c Tue Nov 16 12:08:38 2010
@@ -1902,7 +1902,6 @@ apr_status_t ap_proxy_http_process_respo
 
                     /* Switch the allocator lifetime of the buckets */
                     ap_proxy_buckets_lifetime_transform(r, bb, pass_bb);
-                    apr_brigade_cleanup(bb);
 
                     /* found the last brigade? */
                     if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(pass_bb))) {
@@ -1910,6 +1909,23 @@ apr_status_t ap_proxy_http_process_respo
                         /* signal that we must leave */
                         finish = TRUE;
 
+                        /* the brigade may contain transient buckets that contain
+                         * data that lives only as long as the backend connection.
+                         * Force a setaside so these transient buckets become heap
+                         * buckets that live as long as the request.
+                         */
+                        for (e = APR_BRIGADE_FIRST(pass_bb); e
+                                != APR_BRIGADE_SENTINEL(pass_bb); e
+                                = APR_BUCKET_NEXT(e)) {
+                            apr_bucket_setaside(e, r->pool);
+                        }
+
+                        /* finally it is safe to clean up the brigade from the
+                         * connection pool, as we have forced a setaside on all
+                         * buckets.
+                         */
+                        apr_brigade_cleanup(bb);
+
                         /* make sure we release the backend connection as soon
                          * as we know we are done, so that the backend isn't
                          * left waiting for a slow client to eventually
@@ -1930,6 +1946,7 @@ apr_status_t ap_proxy_http_process_respo
 
                     /* make sure we always clean up after ourselves */
                     apr_brigade_cleanup(pass_bb);
+                    apr_brigade_cleanup(bb);
 
                 } while (!finish);
             }



Mime
View raw message