(I don't know why but I seem to be randomly kicked off this mailing list, so I apologize for breaking the thread chain on this topic and I apologize for the lateness of this reply but random events are conspiring against me...)
> On Mar 4, 2008 16:38:45 GMT, Jim Jagielski wrote: > Looking over this, I see that ap_proxy_connect_to_backend() sets > the socket timeout to conf->timeout already... Correct... and so ProxyTimeout is used for doing a timeout on the "connect" part... however, ap_run_pre_connection resets the timeout to the value of the Timeout directive. so ProxyTimeout does not govern the actual sending and receiving of the proxied request, Timeout does. (This is what I tried to say in the comments, sorry it wasn't clear.) I'm reattaching the patch, just in case. :) Ron > On Feb 21, 2008, at 2:29 PM, Ronald Park wrote: > > > Hi Folks, > > > > After fumbling up a previous attempt to send in this patch, > > I'm going to try again, making sure to attach the patch this > > time. :) > > > > The following patch makes mod_proxy truly use ProxyTimeout > > for the actual sending and receiving of the proxied request; > > as it's currently implemented, it uses ProxyTimeout when > > attempting the connection to the origin server *but* uses > > the value of Timeout for sending and receiving the proxied > > request. > > > > Since mod_proxy introduced entirely new timeout handling in > > 2.2, I have not determined if this problem still exists or > > is even relevant in that branch. However, I do think the > > behavior in the 2.0 line at least does not match the document > > for how ProxyTimeout is expected to work: > > > >> This directive allows a user to specifiy a timeout on proxy requests. > >> This is useful when you have a slow/buggy appserver which hangs, and > >> you would rather just return a timeout and fail gracefully instead of > >> waiting however long it takes the server to return. > > > > Thanks, > > Ron > > <httpd-2.0.63-tproxy.patch> > >
--- modules/proxy/proxy_http.c.orig 2007-09-04 15:33:45.000000000 -0400 +++ modules/proxy/proxy_http.c 2008-02-04 14:57:21.000000000 -0500 @@ -379,6 +379,36 @@ "proxy: HTTP: pre_connection setup failed (%d)", rc); return rc; + } else { + // that pre_connection code sets the socket timeout as + // the value of Timeout which is the timeout of the + // original request; by the time that is hit, our client + // has already been given a timeout + // + // instead, we'll look to see if an env var, proxy-timeout, + // has been set: if so, we use it; otherwise, we use + // the setting for ProxyTimeout (if set); (otherwise, we + // will stick with the value of Timeout.) + const char* tbl_timeout; + apr_interval_time_t timeout = (conf->timeout_set) ? + conf->timeout : 0; + + tbl_timeout = apr_table_get(r->subprocess_env, "proxy-timeout"); + if (tbl_timeout == NULL) { + tbl_timeout = apr_table_get(r->notes, "proxy-timeout"); + } + if (tbl_timeout != NULL) { + int int_timeout = atoi(tbl_timeout); + if (int_timeout > 0) { + timeout = apr_time_from_sec(int_timeout); + } + } + if (timeout > 0) { + apr_socket_timeout_set(p_conn->sock, timeout); + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, + "proxy: setting request timeout (%d)", timeout); + } + } } return OK;