httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ronald Park <>
Subject Re: mod_proxy timeout
Date Fri, 18 Jan 2008 21:44:35 GMT
As a way to apologize for my 'spamming', I think I've
uncovered the issue.  This is either a bug, a known
limitation or a misunderstanding on my part of the
purpose of ProxyTimeout.

Turns out that timeout is set on the socket in two places:
first when it's attempting to get the connection to the
proxy server, in this call:

failed = ap_proxy_connect_to_backend(&p_conn->sock, "HTTP",
                                     p_conn->addr, p_conn->name,
                                     conf, r->server, c->pool);

Here, the 'conf' argument passed allows p_conn->sock's timeout
to be set with conf->timeout if conf->timeout_set is 1.

Later, there's a call to:

rc = ap_run_pre_connection(*origin, p_conn->sock);

This eventually is uncovered to be the function core_pre_connection
found in server/core.c.  In this code, p_conn->sock's timeout
is set with the timeout from *origin->base_server->timeout.

The 'fix' is, after this call, use the timeout you really want
to use.  I *think* this should be conf->timeout... however,
perhaps ProxyTimeout is supposed to be only used to timeout
the connection, not the request.  If that's true, the description
of the directive is confusing. :/

For me, it's actually going to a timeout value set in the notes
table by another module so we can control proxy timeouts per
request "on the fly". :)


On Fri, 2008-01-18 at 12:30 -0500, Ronald Park wrote:
> [[Resending as I suspect my junk mail filters flagged it
> on sending it. :/  However, if this did make it, I apologize
> for this duplicate sending.]]
> Hi Folks,
> I'm trying to get ProxyTimeout to work and having no luck.
> I've set up 2 Apache instances in my network.  These are
> Apache 2.0.59 servers built on a 64 bit Redhat EL4 box.
> On the first, I've just added the following directives:
> ProxyTimeout 2
> ProxyPass /cgi-bin http://<myotherhost>/cgi-bin/
> On the second machine, I have the following simple CGI:
> #!/bin/sh
> sleep 30
> echo Content-type: text/html
> echo
> echo "<HTML><HEAD>"
> echo "<TITLE>Hello</TITLE>"
> echo "</HEAD><BODY>"
> echo "Hello"
> echo "</BODY></HTML>"
> Why doesn't this timeout?
> For 'fun', I' fiddled with the code, namely proxy_http.c,
> right before the call to ap_proxy_connect_to_backend, I
> reduce the value of 'timeout' in the conf struct by a factor
> of 10 (so from 2000000 to 200000, etc) each request.  As
> I reload the page, nothing different happens: each request
> takes 30 secs to finally, successfully return... until I
> finally get down to '200'.  Then, I finally get a 502,
> BAD GATEWAY error.  So at that tiny timeout (200 microsecs?),
> I'm guessing the low level connect times out.  So in some
> regards, timeout is working.
> I did find what I think is a bug in the merge_proxy_config
> function... although it merges the 'timeout' field member
> in the config structure, it's not merging the 'timeout_set'
> member.  However, fixing that did not resolve my issue. :(
> Is there something wrong with my test?
> Thanks,
> Ron

View raw message