Return-Path: Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: (qmail 88971 invoked from network); 9 Aug 2008 21:33:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Aug 2008 21:33:31 -0000 Received: (qmail 55388 invoked by uid 500); 9 Aug 2008 21:33:30 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 55330 invoked by uid 500); 9 Aug 2008 21:33:30 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 55321 invoked by uid 99); 9 Aug 2008 21:33:30 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 09 Aug 2008 14:33:30 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 09 Aug 2008 21:32:42 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 5E04823889BB; Sat, 9 Aug 2008 14:33:10 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r684351 - in /httpd/httpd/trunk: CHANGES modules/proxy/mod_proxy_http.c modules/proxy/proxy_util.c Date: Sat, 09 Aug 2008 21:33:09 -0000 To: cvs@httpd.apache.org From: rpluem@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080809213310.5E04823889BB@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: rpluem Date: Sat Aug 9 14:33:09 2008 New Revision: 684351 URL: http://svn.apache.org/viewvc?rev=684351&view=rev Log: * Introduce environment variable proxy-initial-not-pooled to avoid reusing pooled connections if the client connection is an initial connection. This avoids the "proxy: error reading status line from remote server" error caused by the race condition that the backend server closed the connection after the connection check on our side and before our data reached the backend. Yes, this downgrades performance, especially with HTTP/1.0 clients. Hence it is configurable and off by default. PR: 37770 Modified: httpd/httpd/trunk/CHANGES httpd/httpd/trunk/modules/proxy/mod_proxy_http.c httpd/httpd/trunk/modules/proxy/proxy_util.c Modified: httpd/httpd/trunk/CHANGES URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=684351&r1=684350&r2=684351&view=diff ============================================================================== --- httpd/httpd/trunk/CHANGES [utf-8] (original) +++ httpd/httpd/trunk/CHANGES [utf-8] Sat Aug 9 14:33:09 2008 @@ -2,6 +2,10 @@ Changes with Apache 2.3.0 [ When backported to 2.2.x, remove entry from this file ] + *) mod_proxy_http: Introduce environment variable proxy-initial-not-pooled to + avoid reusing pooled connections if the client connection is an initial + connection. PR 37770. [Ruediger Pluem] + *) mod_proxy: Add connectiontimeout parameter for proxy workers in order to be able to set the timeout for connecting to the backend separately. PR 45445. [Ruediger Pluem, rahul ] 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=684351&r1=684350&r2=684351&view=diff ============================================================================== --- httpd/httpd/trunk/modules/proxy/mod_proxy_http.c (original) +++ httpd/httpd/trunk/modules/proxy/mod_proxy_http.c Sat Aug 9 14:33:09 2008 @@ -1927,6 +1927,19 @@ ap_proxy_ssl_connection_cleanup(backend, r); } + /* + * In the case that we are handling a reverse proxy connection and this + * is not a request that is coming over an already kept alive connection + * with the client, do NOT reuse the connection to the backend, because + * we cannot forward a failure to the client in this case as the client + * does NOT expects this in this situation. + * Yes, this creates a performance penalty. + */ + if ((r->proxyreq == PROXYREQ_REVERSE) && (!c->keepalives) + && (apr_table_get(r->subprocess_env, "proxy-initial-not-pooled"))) { + backend->close = 1; + } + /* Step One: Determine Who To Connect To */ if ((status = ap_proxy_determine_connection(p, r, conf, worker, backend, uri, &url, proxyname, Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/proxy_util.c?rev=684351&r1=684350&r2=684351&view=diff ============================================================================== --- httpd/httpd/trunk/modules/proxy/proxy_util.c (original) +++ httpd/httpd/trunk/modules/proxy/proxy_util.c Sat Aug 9 14:33:09 2008 @@ -2167,6 +2167,11 @@ else { conn->addr = worker->cp->addr; } + /* Close a possible existing socket if we are told to do so */ + if (conn->close) { + socket_cleanup(conn); + conn->close = 0; + } if (err != APR_SUCCESS) { return ap_proxyerror(r, HTTP_BAD_GATEWAY,