httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter A. Friend" <>
Subject Re: Apache and CLOSE_WAIT state
Date Wed, 03 Sep 2008 16:33:50 GMT
Arnab Ganguly wrote:
> Hi All,
> My Apache module hangs when I do a lsof -i:listening port output gives 
> lots of CLOSE_WAIT.
> Initially the state comes out as ESTABLISHED but as the CLOSE_WAIT 
> grows my server hangs.
> What would be procedure in order to prevent this.
> Apache Webserver version is 2.2.8 with MPM=worker and OS=Red-Hat 
> Release 3.0
> Any help would be very much appreciated.
> Thanks and regards
> Arnab
How to fix it depends on what your module is attempting to do. It helps 
to understand what CLOSE_WAIT actually means, so grab your copy of 

When a TCP socket receives a FIN (other end closed the socket) from it's 
peer the socket is then half closed. The FIN from the local socket to 
the peer won't be sent until the application issues the close(). Hence 
the name of the TCP state, CLOSE_WAIT, since TCP is waiting for the 
application to close its end of the connection.

When CLOSE_WAIT piles up and doesn't go away it's usually an indication 
of a "descriptor leak" bug. Something is either preventing progress to 
occur in the HTTP session (we are stuck so never end up calling close), 
or some bug has been introduced that prevents the socket from being 
closed. There are a number of ways this can happen.


View raw message