]> granicus.if.org Git - apache/commitdiff
handle POLLERR/POLLHUP during poll() to avoid high CPU busy loop.
authorEric Covener <covener@apache.org>
Wed, 19 Feb 2014 02:42:29 +0000 (02:42 +0000)
committerEric Covener <covener@apache.org>
Wed, 19 Feb 2014 02:42:29 +0000 (02:42 +0000)
Submitted By: Joffroy Christen <joffroy.christen solvaxis com>, Eric Covener]
Committed By: covener

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1569615 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/proxy/mod_proxy_wstunnel.c

diff --git a/CHANGES b/CHANGES
index d7537b5e3ad2b3b0cbd3e1173b2996551fd6a5dd..7a3efb316e7bb455aa0c77570273756ca21f00a5 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,10 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) mod_proxy_wstunnel: Avoid busy loop on client errors, drop message
+     IDs 02445, 02446, and 02448 to TRACE1 from DEBUG. PR 56145.
+     [Joffroy Christen <joffroy.christen solvaxis com>, Eric Covener]
+
   *) mod_lua: Update r:setcookie() to accept a table of options and add domain,
      path and httponly to the list of options available to set.
      PR 56128 [Edward Lu <Chaosed0 gmail com>, Daniel Gruno]
index 97967fc67008cf18821f55ce2d2445dcf43dbf7b..215fd5c27443f21de96e386a0ae741852be093b9 100644 (file)
@@ -64,7 +64,7 @@ static int proxy_wstunnel_pump(ws_baton_t *baton, apr_time_t timeout) {
             }
         }
 
-        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(02445)
+        ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, APLOGNO(02445)
                 "woke from poll(), i=%d", pollcnt);
 
         for (pi = 0; pi < pollcnt; pi++) {
@@ -73,7 +73,7 @@ static int proxy_wstunnel_pump(ws_baton_t *baton, apr_time_t timeout) {
             if (cur->desc.s == sock) {
                 pollevent = cur->rtnevents;
                 if (pollevent & APR_POLLIN) {
-                    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(02446)
+                    ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, APLOGNO(02446)
                             "sock was readable");
                     rv = proxy_wstunnel_transfer(r, backconn, c, bb, "sock");
                 }
@@ -83,16 +83,33 @@ static int proxy_wstunnel_pump(ws_baton_t *baton, apr_time_t timeout) {
                     ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, APLOGNO(02447)
                             "err/hup on backconn");
                 }
+                else { 
+                    rv = APR_EGENERAL;
+                    ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, APLOGNO(02605)
+                            "unknown event on backconn %d", pollevent);
+                }
                 if (rv != APR_SUCCESS)
                     client_error = 1;
             }
             else if (cur->desc.s == client_socket) {
                 pollevent = cur->rtnevents;
                 if (pollevent & APR_POLLIN) {
-                    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(02448)
+                    ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, APLOGNO(02448)
                             "client was readable");
                     rv = proxy_wstunnel_transfer(r, c, backconn, bb, "client");
                 }
+                else if ((pollevent & APR_POLLERR)
+                        || (pollevent & APR_POLLHUP)) {
+                    rv = APR_EPIPE;
+                    c->aborted = 1;
+                    ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, APLOGNO(02607)
+                            "err/hup on client conn");
+                }
+                else { 
+                    rv = APR_EGENERAL;
+                    ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, APLOGNO(02606)
+                            "unknown event on client conn %d", pollevent);
+                }
             }
             else {
                 rv = APR_EBADF;