You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Ronald Park <ro...@cnet.com> on 2008/02/05 20:52:09 UTC

mod_proxy timeouts in the 2.0

The problem and patch in the below message are in regards to just
the Apache 2.0 line; it seems like a number of improvements in
timeout handling have already been implemented in the 2.2 version
of mod_proxy.

However, also included in my patch is a mechanism to provide even
more granularity in timeouts by setting it via an environment var:
I have not done the work though to find an implementation in the
2.2 line though but if there is an interest, I could investigate it.

On to my problem and a possible patch:

According to the description of the ProxyTimeout directive, this
is the expected behavior of that directive:

> 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.

However, this is not what occurs.  The ProxyTimeout is only used
to obtain the connection to the 'origin server'; when it actually
sends the proxied request and waits for the response, the value of
the Timeout directive is used.

Unfortunately, mod_proxy uses a core function called 'pre_connection'
after the connection has been made (despite the 'pre' in the function
name :D) and therein lies the problem.  That code only has access to
the server config, not the modules configs, and it resets the timeout
to the value of the Timeout directive.

My fix is to reset the timeout *after* the call to pre_connection if
this directive is set.

I also added new functionality allowing a special environment
variable ("proxy-timeout") to be set to overload the directive for
more fine-grained control.  This would allow the following:

ProxyTimeout 15

RewriteRule ^/proxy/(.*)$ http://someotherserver.com/$1

RewriteRule ^/quick/(.*)$ http://someotherserver.com/$1 \
                                      [E=proxy-timeout:5]

RewriteRule ^/slow/(.*)$ http://someotherserver.com/$1 \
                                      [E=proxy-timeout:30]

This allows three different proxies timeouts to the same origin
server (someotherserver.com) based on the URL to the forward
proxy.

Attached is my patch to 2.0.63 to the proxy_http.c file in
modules/proxy.

Thanks,
Ron


Re: mod_proxy timeouts in the 2.0

Posted by Ronald Park <ro...@cnet.com>.
Ack, I'm so sorry for not including the attachment.  Further
complicating the issue, for some reason, emails from this
list are getting eaten or delayed by my company's server and
so I didn't even see the responses to my original mail until
now, a week later. :(

(I've always felt that email clients should scan any outgoing
emails that contain the word 'attached' yet don't actually
have an attachment and pester the user with a popup saying
"Hey idiot, did you mean to attach something to this email?")

Yes, this patch is purely for 2.0.63; I have not had a chance
to try mod_proxy's new timeout features in the 2.2 line yet,
let alone determine how to apply my fix to it if needed.  I
did look over the new code and it's changed quite a bit.

I did though receive one direct response to my email for someone
else who's has a similar concern for the 2.0 line and so I'm
correctly attaching and sending this patch now and hope that
some others find it useful.

Ron

On Wed, 2008-02-06 at 10:34 -0500, Jim Jagielski wrote:
> On Feb 5, 2008, at 2:52 PM, Ronald Park wrote:
> >
> > Attached is my patch to 2.0.63 to the proxy_http.c file in
> > modules/proxy.
> >
> 
> I didn't see any attached patch... :/
> 
> In any case, the normal process is patch applied to
> trunk with then backport proposals to 2.2 and 2.0. A feature
> added to 2.0.x, without it being in 2.2 and trunk is likely
> not gonna happen.
> 

Re: mod_proxy timeouts in the 2.0

Posted by Ronald Park <ro...@cnet.com>.
Sorry again for the lack of attachment. :(

There definitely is confusion here and it's definitely my
fault.  First, the lack of attachment.  Second, I have
made this both a fix *and* a feature both of which only
apply to the 2.0 line.

I'm including the patch again and can modify it to include
just the fix part if that will help get it included in the
2.0 line.

Ron

On Thu, 2008-02-07 at 09:06 +0100, jean-frederic clere wrote:
> Chris H. wrote:
> > Quoting Jim Jagielski <ji...@jaguNET.com>:
> > 
> >>
> >> On Feb 5, 2008, at 2:52 PM, Ronald Park wrote:
> >>>
> >>> Attached is my patch to 2.0.63 to the proxy_http.c file in
> >>> modules/proxy.
> >>>
> >>
> >> I didn't see any attached patch... :/
> 
> Without the patch the whole discussion is useless ;-(
> 
> >>
> >> In any case, the normal process is patch applied to
> >> trunk with then backport proposals to 2.2 and 2.0. A feature
> >> added to 2.0.x, without it being in 2.2 and trunk is likely
> >> not gonna happen.
> > 
> > If I understood the original posting correctly. This is a /fix/
> > not a /feature/. Isn't there any interest in correcting issues
> > in the 2.0.x branch? Or am I to understand that the term "feature"
> > also means "fix(es)". :)
> 
> What we normally do is to fix trunk and port back to 2.2.x and/or 2.0.x.
> 
> Cheers
> 
> Jean-Frederic
> 
> > 
> >>
> >>
> > 
> > 
> > 
> 

Re: mod_proxy timeouts in the 2.0

Posted by jean-frederic clere <jf...@gmail.com>.
Chris H. wrote:
> Quoting Jim Jagielski <ji...@jaguNET.com>:
> 
>>
>> On Feb 5, 2008, at 2:52 PM, Ronald Park wrote:
>>>
>>> Attached is my patch to 2.0.63 to the proxy_http.c file in
>>> modules/proxy.
>>>
>>
>> I didn't see any attached patch... :/

Without the patch the whole discussion is useless ;-(

>>
>> In any case, the normal process is patch applied to
>> trunk with then backport proposals to 2.2 and 2.0. A feature
>> added to 2.0.x, without it being in 2.2 and trunk is likely
>> not gonna happen.
> 
> If I understood the original posting correctly. This is a /fix/
> not a /feature/. Isn't there any interest in correcting issues
> in the 2.0.x branch? Or am I to understand that the term "feature"
> also means "fix(es)". :)

What we normally do is to fix trunk and port back to 2.2.x and/or 2.0.x.

Cheers

Jean-Frederic

> 
>>
>>
> 
> 
> 


Re: mod_proxy timeouts in the 2.0

Posted by Jim Jagielski <ji...@jaguNET.com>.
On Feb 6, 2008, at 5:04 PM, Chris H. wrote:

> Quoting Jim Jagielski <ji...@jaguNET.com>:
>
>>
>> On Feb 5, 2008, at 2:52 PM, Ronald Park wrote:
>>>
>>> Attached is my patch to 2.0.63 to the proxy_http.c file in
>>> modules/proxy.
>>>
>>
>> I didn't see any attached patch... :/
>>
>> In any case, the normal process is patch applied to
>> trunk with then backport proposals to 2.2 and 2.0. A feature
>> added to 2.0.x, without it being in 2.2 and trunk is likely
>> not gonna happen.
>
> If I understood the original posting correctly. This is a /fix/
> not a /feature/. Isn't there any interest in correcting issues
> in the 2.0.x branch? Or am I to understand that the term "feature"
> also means "fix(es)". :)
>
>>

If the bug exists in all 3 versions, then it should 1st
be applied to trunk, and then backported to 2.2 and 2.0.
If only in 2.2 and 2.0, then the patch needs to be looked
at and voted on in both cases. If it's just for 2.0,
then again, we need to see the patch before we can decide
anything.

For features or fixes.

Re: mod_proxy timeouts in the 2.0

Posted by "Chris H." <ch...@1command.com>.
Quoting Jim Jagielski <ji...@jaguNET.com>:

>
> On Feb 5, 2008, at 2:52 PM, Ronald Park wrote:
>>
>> Attached is my patch to 2.0.63 to the proxy_http.c file in
>> modules/proxy.
>>
>
> I didn't see any attached patch... :/
>
> In any case, the normal process is patch applied to
> trunk with then backport proposals to 2.2 and 2.0. A feature
> added to 2.0.x, without it being in 2.2 and trunk is likely
> not gonna happen.

If I understood the original posting correctly. This is a /fix/
not a /feature/. Isn't there any interest in correcting issues
in the 2.0.x branch? Or am I to understand that the term "feature"
also means "fix(es)". :)

>
>



-- 
panic: kernel trap (ignored)




Re: mod_proxy timeouts in the 2.0

Posted by Jim Jagielski <ji...@jaguNET.com>.
On Feb 5, 2008, at 2:52 PM, Ronald Park wrote:
>
> Attached is my patch to 2.0.63 to the proxy_http.c file in
> modules/proxy.
>

I didn't see any attached patch... :/

In any case, the normal process is patch applied to
trunk with then backport proposals to 2.2 and 2.0. A feature
added to 2.0.x, without it being in 2.2 and trunk is likely
not gonna happen.