From: Eric Covener Date: Wed, 19 Feb 2014 02:42:29 +0000 (+0000) Subject: handle POLLERR/POLLHUP during poll() to avoid high CPU busy loop. X-Git-Tag: 2.5.0-alpha~4482 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=33f7dbafce1a7cf76da1aa83d7cfcb7bb599844b;p=apache handle POLLERR/POLLHUP during poll() to avoid high CPU busy loop. Submitted By: Joffroy Christen , Eric Covener] Committed By: covener git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1569615 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index d7537b5e3a..7a3efb316e 100644 --- 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 , 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 , Daniel Gruno] diff --git a/modules/proxy/mod_proxy_wstunnel.c b/modules/proxy/mod_proxy_wstunnel.c index 97967fc670..215fd5c274 100644 --- a/modules/proxy/mod_proxy_wstunnel.c +++ b/modules/proxy/mod_proxy_wstunnel.c @@ -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;