You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2008/09/17 16:32:39 UTC

svn commit: r696322 - in /httpd/httpd/branches/2.2.x: ./ STATUS docs/ modules/proxy/mod_proxy_ajp.c support/ab.c support/suexec.c

Author: jim
Date: Wed Sep 17 07:32:37 2008
New Revision: 696322

URL: http://svn.apache.org/viewvc?rev=696322&view=rev
Log:
Merge r693392 from trunk:

* If CPING fails retry once more with a fresh TCP connection. If this fails
  as well give up.

Submitted by: rpluem
Reviewed by: jim

Modified:
    httpd/httpd/branches/2.2.x/   (props changed)
    httpd/httpd/branches/2.2.x/STATUS
    httpd/httpd/branches/2.2.x/docs/   (props changed)
    httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy_ajp.c
    httpd/httpd/branches/2.2.x/support/ab.c   (props changed)
    httpd/httpd/branches/2.2.x/support/suexec.c   (props changed)

Propchange: httpd/httpd/branches/2.2.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Sep 17 07:32:37 2008
@@ -1 +1 @@
-/httpd/httpd/trunk:647395,660461,660566,664330,678761,681190,682369,683626,685112,686805,686809,687099,687754,693727-693728
+/httpd/httpd/trunk:647395,660461,660566,664330,678761,681190,682369,683626,685112,686805,686809,687099,687754,693392,693727-693728

Modified: httpd/httpd/branches/2.2.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/STATUS?rev=696322&r1=696321&r2=696322&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/STATUS (original)
+++ httpd/httpd/branches/2.2.x/STATUS Wed Sep 17 07:32:37 2008
@@ -102,13 +102,6 @@
        http://people.apache.org/~covener/2.2.x-auth_alias_digest.diff 
    +1: covener, rpluem, jerenkrantz
 
- * mod_proxy_ajp: If CPING fails retry once more with a fresh TCP connection.
-   If this fails as well give up.
-   Trunk version of patches:
-      http://svn.apache.org/viewvc?rev=693392&view=rev
-   Backport version for 2.2.x of patch:
-       Trunk version of patches works
-   +1: rpluem, covener, jerenkrantz
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ New proposals should be added at the end of the list ]

Propchange: httpd/httpd/branches/2.2.x/docs/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Sep 17 07:32:37 2008
@@ -1 +1 @@
-/httpd/httpd/trunk/docs:647395,660461,660566,664330,675610,678761,681190,682369,683626,684351,685112,686549,686805,686809,687099,687754,692325,693727-693728
+/httpd/httpd/trunk/docs:647395,660461,660566,664330,675610,678761,681190,682369,683626,684351,685112,686549,686805,686809,687099,687754,692325,693392,693727-693728

Modified: httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy_ajp.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy_ajp.c?rev=696322&r1=696321&r2=696322&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy_ajp.c (original)
+++ httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy_ajp.c Wed Sep 17 07:32:37 2008
@@ -550,6 +550,7 @@
     conn_rec *origin = NULL;
     proxy_conn_rec *backend = NULL;
     const char *scheme = "AJP";
+    int retry;
     proxy_dir_conf *dconf = ap_get_module_config(r->per_dir_config,
                                                  &proxy_module);
 
@@ -595,43 +596,53 @@
     backend->is_ssl = 0;
     backend->close_on_recycle = 0;
 
-    /* Step One: Determine Who To Connect To */
-    status = ap_proxy_determine_connection(p, r, conf, worker, backend,
-                                           uri, &url, proxyname, proxyport,
-                                           server_portstr,
-                                           sizeof(server_portstr));
-
-    if (status != OK)
-        goto cleanup;
-
-    /* Step Two: Make the Connection */
-    if (ap_proxy_connect_backend(scheme, backend, worker, r->server)) {
-        ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
-                     "proxy: AJP: failed to make connection to backend: %s",
-                     backend->hostname);
-        status = HTTP_SERVICE_UNAVAILABLE;
-        goto cleanup;
-    }
-
-    /* Handle CPING/CPONG */
-    if (worker->ping_timeout_set) {
-        status = ajp_handle_cping_cpong(backend->sock, r,
-                                        worker->ping_timeout);
-        if (status != APR_SUCCESS) {
-            backend->close++;
-            ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server,
-                         "proxy: AJP: cping/cpong failed to %pI (%s)",
-                         worker->cp->addr,
-                         worker->hostname);
+    retry = 0;
+    while (retry < 2) {
+        /* Step One: Determine Who To Connect To */
+        status = ap_proxy_determine_connection(p, r, conf, worker, backend,
+                                               uri, &url, proxyname, proxyport,
+                                               server_portstr,
+                                               sizeof(server_portstr));
+
+        if (status != OK)
+            break;
+
+        /* Step Two: Make the Connection */
+        if (ap_proxy_connect_backend(scheme, backend, worker, r->server)) {
+            ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
+                         "proxy: AJP: failed to make connection to backend: %s",
+                         backend->hostname);
             status = HTTP_SERVICE_UNAVAILABLE;
-            goto cleanup;
+            break;
+        }
+
+        /* Handle CPING/CPONG */
+        if (worker->ping_timeout_set) {
+            status = ajp_handle_cping_cpong(backend->sock, r,
+                                            worker->ping_timeout);
+            /*
+             * In case the CPING / CPONG failed for the first time we might be
+             * just out of luck and got a faulty backend connection, but the
+             * backend might be healthy nevertheless. So ensure that the backend
+             * TCP connection gets closed and try it once again.
+             */
+            if (status != APR_SUCCESS) {
+                backend->close++;
+                ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server,
+                             "proxy: AJP: cping/cpong failed to %pI (%s)",
+                             worker->cp->addr,
+                             worker->hostname);
+                status = HTTP_SERVICE_UNAVAILABLE;
+                retry++;
+                continue;
+            }
         }
+        /* Step Three: Process the Request */
+        status = ap_proxy_ajp_request(p, r, backend, origin, dconf, uri, url,
+                                      server_portstr);
+        break;
     }
-    /* Step Three: Process the Request */
-    status = ap_proxy_ajp_request(p, r, backend, origin, dconf, uri, url,
-                                  server_portstr);
 
-cleanup:
     /* Do not close the socket */
     ap_proxy_release_connection(scheme, backend, r->server);
     return status;

Propchange: httpd/httpd/branches/2.2.x/support/ab.c
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Sep 17 07:32:37 2008
@@ -1 +1 @@
-/httpd/httpd/trunk/support/ab.c:83751-655654,657433,660461,660566,664330,678761,681190,682369,683626,685112,686805,686809,687099,687754,693727-693728
+/httpd/httpd/trunk/support/ab.c:83751-655654,657433,660461,660566,664330,678761,681190,682369,683626,685112,686805,686809,687099,687754,693392,693727-693728

Propchange: httpd/httpd/branches/2.2.x/support/suexec.c
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Sep 17 07:32:37 2008
@@ -1 +1 @@
-/httpd/httpd/trunk/support/suexec.c:647395,655711,660461,660566,664330,678761,681190,682369,683626,685112,686805,686809,687099,687754,693727-693728
+/httpd/httpd/trunk/support/suexec.c:647395,655711,660461,660566,664330,678761,681190,682369,683626,685112,686805,686809,687099,687754,693392,693727-693728