Index: modules/proxy/proxy_util.c =================================================================== --- modules/proxy/proxy_util.c (revision 1026618) +++ modules/proxy/proxy_util.c (working copy) @@ -2026,10 +2026,13 @@ proxy_conn_rec *conn, server_rec *s) { - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, - "proxy: %s: has released connection for (%s)", - proxy_function, conn->worker->hostname); - connection_cleanup(conn); + if (!conn->cleaned) { + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, + "proxy: %s: has released connection for (%s)", + proxy_function, conn->worker->hostname); + connection_cleanup(conn); + conn->cleaned = 1; + } return OK; } Index: modules/proxy/mod_proxy_http.c =================================================================== --- modules/proxy/mod_proxy_http.c (revision 1026618) +++ modules/proxy/mod_proxy_http.c (working copy) @@ -1818,8 +1818,18 @@ /* found the last brigade? */ if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(bb))) { + /* signal that we must leave */ finish = TRUE; + + /* 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 + * acknowledge the data. + */ + ap_proxy_release_connection(backend->worker->scheme, + backend, r->server); + } /* try send what we read */ @@ -1843,6 +1853,14 @@ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "proxy: header only"); + /* 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 + * acknowledge the data. + */ + ap_proxy_release_connection(backend->worker->scheme, + backend, r->server); + /* Pass EOS bucket down the filter chain. */ e = apr_bucket_eos_create(c->bucket_alloc); APR_BRIGADE_INSERT_TAIL(bb, e); Index: modules/proxy/mod_proxy.h =================================================================== --- modules/proxy/mod_proxy.h (revision 1026618) +++ modules/proxy/mod_proxy.h (working copy) @@ -248,6 +248,7 @@ int need_flush;/* Flag to decide whether we need to flush the * filter chain or not */ void *forward; /* opaque forward proxy data */ + int cleaned:1; /* connection cleaned? */ } proxy_conn_rec; typedef struct {