diff -ur apache2-2.4.27/modules/proxy/mod_proxy_connect.c apache2-2.4.27.new/modules/proxy/mod_proxy_connect.c --- apache2-2.4.27/modules/proxy/mod_proxy_connect.c 2017-10-17 10:04:29.244310247 +0200 +++ apache2-2.4.27.new/modules/proxy/mod_proxy_connect.c 2017-10-17 09:00:32.304658856 +0200 @@ -422,6 +422,13 @@ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01025) "backend was readable"); #endif + /* now we know, we can read, but we can't be sure that + * there's enogh room in the outgoing socket to write all + * we read. Reduce timeout on outgoing socket to not risk + * blocking for three minutes in poll(), called by + * send_brigade_blocking(), when the socket send buffer + * fills up */ + apr_socket_timeout_set(client.pfd.desc.s, 10); done |= ap_proxy_transfer_between_connections(r, backend.c, client.c, @@ -431,6 +438,8 @@ NULL, CONN_BLKSZ, 1); + /* reset timeout */ + apr_socket_timeout_set(client.pfd.desc.s, client.timeout); if (!done && client.c->data_in_output_filters) { apr_pollset_remove(pollset, &client.pfd); client.pfd.reqevents = APR_POLLOUT; @@ -465,6 +474,13 @@ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01027) "client was readable"); #endif + /* now we know, we can read, but we can't be sure that + * there's enogh room in the outgoing socket to write all + * we read. Reduce timeout on outgoing socket to not risk + * blocking for three minutes in poll(), called by + * send_brigade_blocking(), when the socket send buffer + * fills up */ + apr_socket_timeout_set(backend.pfd.desc.s, 10); done |= ap_proxy_transfer_between_connections(r, client.c, backend.c, @@ -474,6 +490,8 @@ NULL, CONN_BLKSZ, 1); + /* reset timeout */ + apr_socket_timeout_set(backend.pfd.desc.s, backend.timeout); if (!done && backend.c->data_in_output_filters) { apr_pollset_remove(pollset, &backend.pfd); backend.pfd.reqevents = APR_POLLOUT;