You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Anthony Catel <p...@lya.eu> on 2009/05/22 01:55:28 UTC

[users@httpd] mod_proxy_http persistant connection issue

Hi all,

Hi, I have a question about mod_proxy_http. Apache keep the connection
alive with the proxied server even if the user has disconnected.
(.htaccess http://apache.pastebin.ca/1430422).

Any idea ? ;)

Thanks

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_proxy_http persistant connection issue

Posted by André Warnier <aw...@ice-sa.com>.
Anthony Catel wrote:
> André Warnier a écrit :
>> Anthony Catel wrote:
>> ...
>>
> So if the proxied server never close the connection Apache will have a
> ghost connection during "ProxyTimeout value" seconds. It's annoying :p
> 
Not "never close the connection"; rather, if the proxied server never 
finishes answering to the proxying server (and, there is no connection 
timeout).
What is the proxying server supposed to do instead ?

Or, take this another way : suppose the proxy server isn't there, and 
the client connects directly to the final server.  What do you think 
happens then, that is any different ?
If the client goes away while the server is busy generating the response 
(say, consulting a database), the server will also notice only when it 
tries to send something to the client, through the now useless socket.

Or, yet another way : there is no "interrupt" generated when the client 
goes away, which would enable the server to notice the fact, before it 
tries to write to, or read from, the client socket.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_proxy_http persistant connection issue

Posted by Anthony Catel <p...@lya.eu>.
André Warnier a écrit :
> Anthony Catel wrote:
> ...
>>
>> But if the client hand-up, the read() loop (of the client) will return.
>> So Apache know that the client is disconnected. Why Apache doesn't
>> shutdown the socket to the proxied server when this happen ?
>>
> Sorry, I was only loosely following this thread.
> If indeed, at the time of the problem, Apache is reading from the
> client, it will notice that the client socket is closed at its next
> read().  And I am sure it will then close the connection to the
> proxied-to server also.
> I thought the problem was that Apache sent the request to the
> proxied-to server, and was waiting for that server to provide a response.
> In that last case, it will not notice that the client is gone, before
> the connection with the proxied-to server times out, and it tries to
> send some error to the client.
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server
> Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
So if the proxied server never close the connection Apache will have a
ghost connection during "ProxyTimeout value" seconds. It's annoying :p




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_proxy_http persistant connection issue

Posted by André Warnier <aw...@ice-sa.com>.
Anthony Catel wrote:
...
> 
> But if the client hand-up, the read() loop (of the client) will return.
> So Apache know that the client is disconnected. Why Apache doesn't
> shutdown the socket to the proxied server when this happen ?
> 
Sorry, I was only loosely following this thread.
If indeed, at the time of the problem, Apache is reading from the 
client, it will notice that the client socket is closed at its next 
read().  And I am sure it will then close the connection to the 
proxied-to server also.
I thought the problem was that Apache sent the request to the proxied-to 
server, and was waiting for that server to provide a response.
In that last case, it will not notice that the client is gone, before 
the connection with the proxied-to server times out, and it tries to 
send some error to the client.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_proxy_http persistant connection issue

Posted by Anthony Catel <p...@lya.eu>.
André Warnier a écrit :
> Anthony Catel wrote:
>> Eric Covener a écrit :
>>> On Sat, May 23, 2009 at 10:21 AM, Anthony Catel <p...@lya.eu> wrote:
>>>  
>>>> I don't see any reasons why Apache couldn't be aware if the client
>>>> hung
>>>> up gracefully.
>>>>     
>>> Patches are always welcome.
>>>
>>>   
>> Alright ;) Just wanted to know if it was a bug or a feature.
>>
> It's a feature, but not only of Apache.
> Apache is blocked on a read() from the proxied-to server, waiting for
> an answer.  When it return from that read() (if ever), it will try to
> write() something to the client socket (the proper response from the
> proxied server, or an error message). Only then will it receive an
> error back, because the client is now gone.
> You don't get an error from a socket, unless you try to do something
> with it.
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server
> Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
Hi André,

But if the client hand-up, the read() loop (of the client) will return.
So Apache know that the client is disconnected. Why Apache doesn't
shutdown the socket to the proxied server when this happen ?

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_proxy_http persistant connection issue

Posted by André Warnier <aw...@ice-sa.com>.
Anthony Catel wrote:
> Eric Covener a écrit :
>> On Sat, May 23, 2009 at 10:21 AM, Anthony Catel <p...@lya.eu> wrote:
>>   
>>> I don't see any reasons why Apache couldn't be aware if the client hung
>>> up gracefully.
>>>     
>> Patches are always welcome.
>>
>>   
> Alright ;) Just wanted to know if it was a bug or a feature.
> 
It's a feature, but not only of Apache.
Apache is blocked on a read() from the proxied-to server, waiting for an 
answer.  When it return from that read() (if ever), it will try to 
write() something to the client socket (the proper response from the 
proxied server, or an error message). Only then will it receive an error 
back, because the client is now gone.
You don't get an error from a socket, unless you try to do something 
with it.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_proxy_http persistant connection issue

Posted by Anthony Catel <p...@lya.eu>.
Eric Covener a écrit :
> On Sat, May 23, 2009 at 10:21 AM, Anthony Catel <p...@lya.eu> wrote:
>   
>> I don't see any reasons why Apache couldn't be aware if the client hung
>> up gracefully.
>>     
>
> Patches are always welcome.
>
>   
Alright ;) Just wanted to know if it was a bug or a feature.

Thanks

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_proxy_http persistant connection issue

Posted by Eric Covener <co...@gmail.com>.
On Sat, May 23, 2009 at 10:21 AM, Anthony Catel <p...@lya.eu> wrote:
> I don't see any reasons why Apache couldn't be aware if the client hung
> up gracefully.

Patches are always welcome.

-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_proxy_http persistant connection issue

Posted by Anthony Catel <p...@lya.eu>.
Eric Covener a écrit :
> On Sat, May 23, 2009 at 9:16 AM, Anthony Catel <p...@lya.eu> wrote:
>   
>> Eric Covener a écrit :
>>     
>>> On Thu, May 21, 2009 at 7:55 PM, Anthony Catel <p...@lya.eu> wrote:
>>>       
>>>> Hi all,
>>>>
>>>> Hi, I have a question about mod_proxy_http. Apache keep the connection
>>>> alive with the proxied server even if the user has disconnected.
>>>> (.htaccess http://apache.pastebin.ca/1430422).
>>>>
>>>> Any idea ? ;)
>>>>         
>>> Try setting the intenral environment variable proxy-nokeepalive,
>>> although it's heavier handed than you'd want.
>>>
>>> http://httpd.apache.org/docs/2.2/mod/mod_proxy_http.html#env
>>>
>>>       
>> I already tryed to turn on this variable without success.
>>
>> My problem happen when the proxied keep the connection openned but
>> without any response. If the client disconnect, Apache still wait for a
>> server response.
>>     
>
> When Apache is waiting for the server to respond, it doesn't know that
> the client hung up.  ProxyTimeout?
>
>   

I don't see any reasons why Apache couldn't be aware if the client hung
up gracefully.

--
Anthony Catel

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_proxy_http persistant connection issue

Posted by Eric Covener <co...@gmail.com>.
On Sat, May 23, 2009 at 9:16 AM, Anthony Catel <p...@lya.eu> wrote:
> Eric Covener a écrit :
>> On Thu, May 21, 2009 at 7:55 PM, Anthony Catel <p...@lya.eu> wrote:
>>> Hi all,
>>>
>>> Hi, I have a question about mod_proxy_http. Apache keep the connection
>>> alive with the proxied server even if the user has disconnected.
>>> (.htaccess http://apache.pastebin.ca/1430422).
>>>
>>> Any idea ? ;)
>>
>> Try setting the intenral environment variable proxy-nokeepalive,
>> although it's heavier handed than you'd want.
>>
>> http://httpd.apache.org/docs/2.2/mod/mod_proxy_http.html#env
>>
>
> I already tryed to turn on this variable without success.
>
> My problem happen when the proxied keep the connection openned but
> without any response. If the client disconnect, Apache still wait for a
> server response.

When Apache is waiting for the server to respond, it doesn't know that
the client hung up.  ProxyTimeout?

-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_proxy_http persistant connection issue

Posted by Anthony Catel <p...@lya.eu>.
Eric Covener a écrit :
> On Thu, May 21, 2009 at 7:55 PM, Anthony Catel <p...@lya.eu> wrote:
>> Hi all,
>>
>> Hi, I have a question about mod_proxy_http. Apache keep the connection
>> alive with the proxied server even if the user has disconnected.
>> (.htaccess http://apache.pastebin.ca/1430422).
>>
>> Any idea ? ;)
> 
> Try setting the intenral environment variable proxy-nokeepalive,
> although it's heavier handed than you'd want.
> 
> http://httpd.apache.org/docs/2.2/mod/mod_proxy_http.html#env
> 

I already tryed to turn on this variable without success.

My problem happen when the proxied keep the connection openned but
without any response. If the client disconnect, Apache still wait for a
server response.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_proxy_http persistant connection issue

Posted by Eric Covener <co...@gmail.com>.
On Thu, May 21, 2009 at 7:55 PM, Anthony Catel <p...@lya.eu> wrote:
> Hi all,
>
> Hi, I have a question about mod_proxy_http. Apache keep the connection
> alive with the proxied server even if the user has disconnected.
> (.htaccess http://apache.pastebin.ca/1430422).
>
> Any idea ? ;)

Try setting the intenral environment variable proxy-nokeepalive,
although it's heavier handed than you'd want.

http://httpd.apache.org/docs/2.2/mod/mod_proxy_http.html#env

-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org