httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Arnab Ganguly" <>
Subject Re: Apache and CLOSE_WAIT state
Date Thu, 04 Sep 2008 11:27:20 GMT
Issue it that I am using Apache internal system calls like
[ap_setup_client_block,  ap_should_client_block , ap_get_client_block]
for client communication and the socket descriptors are not available
at this level, as per the apache doc ,when the Apache pool is
destroyed the sockets are also going to closed.But seems to be not
happening or may be I am doing something silly. How do I make sure the
sockets are being closed once the client disconnects.
Thanks in advance.

On Wed, Sep 3, 2008 at 10:03 PM, Peter A. Friend <> wrote:

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

View raw message