httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Woodworth" <>
Subject Re: mod_proxy race condition bug #37770
Date Mon, 12 May 2008 20:15:30 GMT
I haven't looked at the code in mod_proxy to see how it handles the
Keep-Alive header returned by the backend server, but what I'm seeing
in this tcpdump I have that shows the proxy error happening is that
the backend webserver is IIS, and it is not sending any Connection or
Keep-Alive headers back to mod_proxy, even though mod_proxy sent a
Connection: Keep-Alive header.  But, this is HTTP 1.1 -- is the server
required to send back a Connection and Keep-Alive header?

What I'm wondering is, if the server doesn't send back a Keep-Alive
header that specifies the timeout and max requests (e.g., "Keep-Alive:
timeout=15, max=500"), then does mod_proxy just default to an infinite
(or very large) timeout for that connection?  And somehow it's not
noticing that the server closed the connection?  What I see is that in
a nearly 700 second long tcp dump, there are a few mod_proxy requests
made to the backend w/o any SYN/SYN-ACK/ACK TCP handshaking happening
before the GET packet, which means that Apache must think that the
socket is still open -- i.e., it used the socket for a connection a
bunch of minutes ago, and still thinks it's alive.  But I see this
happening 600 seconds into the dump, without any other activity on the
same socket prior to that in the dump, which leads me to think that
Apache is just keeping the socket around for quite a long time.  But
it surprises me that IIS hasn't closed the socket by then, so that by
the time Apache tried to use it it would notice it was closed...hmmm,
very strange.


On Mon, May 12, 2008 at 3:31 PM, Nick Kew <> wrote:
> On Mon, 12 May 2008 13:52:18 -0400
>  "Adam Woodworth" <> wrote:
>  > Hi,
>  >
>  > I was wondering if anyone might have some more information on bug
>  > #37770.  I've added a comment there recently, at the end of the bug
>  > report, #83.
>  >
>  >
>  If this is indeed a race condition biting you, it's possible
>  you could fix it by setting a sufficiently low ttl value that
>  the backend's ttl will be guaranteed to outlive it - depending
>  of course on backend behaviour.  So if the backend has a
>  15 second ttl, set 10 secs in the proxy, and the remaining
>  5 secs provide a good buffer against a race condition.
>  Except that ttl doesn't work exactly as documented.
>  There's a similar issue with ttl and DBD database connections.
>  I've just posted on the subject to dev@apr ("apr_reslist
>  semantics").  This could enable you to configure apache
>  to avoid this problem without sacrificing backend keepalives
>  altogether.
>  --
>  Nick Kew
>  Application Development with Apache - the Apache Modules Book

View raw message