You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Bongjae Chang <bo...@gmail.com> on 2012/05/24 06:25:39 UTC

[users@httpd] CLOSE_WAIT problem

Hi all,

I sent this issue to the dev mailing but I couldn't receive any responses. I
think this subject is fit to be discussed in the user mailing so I am
sending this again. :-)

When I tested mod_proxy + mod_proxy_balancer + (mod_proxy_ajp or
mod_proxy_http) with worker mpm, I always met CLOSE_WAIT state in apache
httpd proxy side.

I tested the following scenario.

- Sending a request at the browser -> apache httpd,  mod proxy -> ajp or
http java server(1)
- Normally, browser received the response correctly and the connection state
became to be ESTABLISHED.
- And java server closed the ajp or http connection with timeout(Or
terminate java server forcibly).
- Then apache httpd proxy machine always had the CLOSE_WAIT state about the
connection.

It seemed that the apache httpd proxy modules(?) did not try to close the
invalid socket which had been already closed at the peer side(the backend
java server side).

Perhaps is it already the known issue?

When I searched similar issues, I found
https://issues.apache.org/bugzilla/show_bug.cgi?id=51814 .

Actually, I am not sure that this problem is related to mod_proxy modules
because I could meet the same problem with using mod_jk(In other words, I
think that it can be httpd's issue. but I am not sure). In mod_jk, I could
work around the problem with using periodic ping logic which cleaned up the
CLOSE_WAIT connections.

Please give me some advice if I am misunderstanding something.

I'd appreciate some help.

Thanks!

--
httpd version: 2.4.2
backend java server: grizzly http/ajp, playframework(maybe it uses netty)
os: httpd(Linux 2.6.18 x86_64), backend server(MacOs)
--

Regards,
Bongjae Chang



[users@httpd] unsubscribe

Posted by Luke Lozier <lu...@bibliopolis.com>.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] CLOSE_WAIT problem

Posted by Bongjae Chang <bo...@gmail.com>.
Hi Igor,

Right. Maybe I can eliminate them as os params.

But, I agree the following contents("It is not a TCP tuning issue") about
CLOSE_WAIT.

http://www.sunmanagers.org/pipermail/summaries/2006-January/007068.html

But, thank you again for your information!

Thanks.

Regards,
Bongjae Chang

From:  Igor Cicimov <ic...@gmail.com>
Reply-To:  <us...@httpd.apache.org>
Date:  Friday, May 25, 2012 7:32 AM
To:  <us...@httpd.apache.org>
Subject:  Re: [users@httpd] CLOSE_WAIT problem


You can reduce the time on OS level if you want by tuning the tcp stack.
On May 25, 2012 3:00 AM, "Bongjae Chang" <bo...@gmail.com> wrote:
> Hi Eric,
> Thank you for quick reply.
>  
> You mean if Apache picks up the closed conn and tries to do some I/O
> operations like writing, Apache will failover the conn(with closing the conn
> and creating/reusing new conn). So CLOSE_WAIT may be normal in this case,
> right?
>  
> IMHO, as soon as connections are closed from backend, if Apache can detect
> closed connections of backend and close them explicitly, CLOSE_WAITs can
> disappear as soon as possible before Apache tries to reuse them.
>  
> Honestly, I didn't know the CLOSE_WAIT conn would be able to be reused because
> new connections always established in my test(I shut down the old backend and
> rebooted the new backend, then both ESTABLISHED and CLOSE_WAIT existed).
>  
> And I read the default max number which will be allowed to backend is
> ThreadsPerChild directive and users can set the max or ThreadsPerChild to be a
> big number. Then, I think many CLOSE_WAITs can be piled up. It's a waste of
> FDs.
>  
> Actually, I was afraid of the following situation.
>  
> 1. Apache has many backend connections(i.g 8080 backend port)
> 2. Backend server should be replaced for maintenace
> 3. So Apache connects new backend server(i.g 9090 backend port) dynamically
> without reboot and old backend server will be shut down
> 4. Then all old backend connections(i.g 8080 backend port) will become to be
> CLOSE_WAIT state for long time.
>  
> At this case, I would like to know Apache can also clean up 8080 ports of
> CLOSE_WAIT state.
>  
> Thanks in advance!
>  
> Regards,
> Bongjae Chang
> 
>  
> On Thu, May 24, 2012 at 7:25 PM, Eric Covener <co...@gmail.com> wrote:
>> Backend connections sit in close_wait until Apache tries to reuse
>> them. What problem does it cause?
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>> 
> 



Re: [users@httpd] CLOSE_WAIT problem

Posted by Igor Cicimov <ic...@gmail.com>.
You can reduce the time on OS level if you want by tuning the tcp stack.
 On May 25, 2012 3:00 AM, "Bongjae Chang" <bo...@gmail.com> wrote:

> Hi Eric,
> Thank you for quick reply.
>
> You mean if Apache picks up the closed conn and tries to do some I/O
> operations like writing, Apache will failover the conn(with closing the
> conn and creating/reusing new conn). So CLOSE_WAIT may be normal in this
> case, right?
>
> IMHO, as soon as connections are closed from backend, if Apache can detect
> closed connections of backend and close them explicitly, CLOSE_WAITs can
> disappear as soon as possible before Apache tries to reuse them.
>
> Honestly, I didn't know the CLOSE_WAIT conn would be able to be reused
> because new connections always established in my test(I shut down the old
> backend and rebooted the new backend, then both ESTABLISHED and CLOSE_WAIT
> existed).
>
> And I read the default max number which will be allowed to backend is
> ThreadsPerChild directive and users can set the max or ThreadsPerChild to
> be a big number. Then, I think many CLOSE_WAITs can be piled up. It's a
> waste of FDs.
>
> Actually, I was afraid of the following situation.
>
> 1. Apache has many backend connections(i.g 8080 backend port)
> 2. Backend server should be replaced for maintenace
> 3. So Apache connects new backend server(i.g 9090 backend
> port) dynamically without reboot and old backend server will be shut down
> 4. Then all old backend connections(i.g 8080 backend port) will become to
> be CLOSE_WAIT state for long time.
>
> At this case, I would like to know Apache can also clean up 8080 ports of
> CLOSE_WAIT state.
>
> Thanks in advance!
>
> Regards,
> Bongjae Chang
>
>
> On Thu, May 24, 2012 at 7:25 PM, Eric Covener <co...@gmail.com> wrote:
>
>> Backend connections sit in close_wait until Apache tries to reuse
>> them. What problem does it cause?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
>>
>

Re: [users@httpd] CLOSE_WAIT problem

Posted by Bongjae Chang <bo...@gmail.com>.
Hi Eric,
Thank you for quick reply.

You mean if Apache picks up the closed conn and tries to do some I/O
operations like writing, Apache will failover the conn(with closing the
conn and creating/reusing new conn). So CLOSE_WAIT may be normal in this
case, right?

IMHO, as soon as connections are closed from backend, if Apache can detect
closed connections of backend and close them explicitly, CLOSE_WAITs can
disappear as soon as possible before Apache tries to reuse them.

Honestly, I didn't know the CLOSE_WAIT conn would be able to be reused
because new connections always established in my test(I shut down the old
backend and rebooted the new backend, then both ESTABLISHED and CLOSE_WAIT
existed).

And I read the default max number which will be allowed to backend is
ThreadsPerChild directive and users can set the max or ThreadsPerChild to
be a big number. Then, I think many CLOSE_WAITs can be piled up. It's a
waste of FDs.

Actually, I was afraid of the following situation.

1. Apache has many backend connections(i.g 8080 backend port)
2. Backend server should be replaced for maintenace
3. So Apache connects new backend server(i.g 9090 backend port) dynamically
without reboot and old backend server will be shut down
4. Then all old backend connections(i.g 8080 backend port) will become to
be CLOSE_WAIT state for long time.

At this case, I would like to know Apache can also clean up 8080 ports of
CLOSE_WAIT state.

Thanks in advance!

Regards,
Bongjae Chang


On Thu, May 24, 2012 at 7:25 PM, Eric Covener <co...@gmail.com> wrote:

> Backend connections sit in close_wait until Apache tries to reuse
> them. What problem does it cause?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

Re: [users@httpd] CLOSE_WAIT problem

Posted by Eric Covener <co...@gmail.com>.
Backend connections sit in close_wait until Apache tries to reuse
them. What problem does it cause?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org