connections in CLOSE_WAIT

Dk Jack dnj0496 at gmail.com
Thu Jul 25 02:51:25 UTC 2019


I was able to resolve this by invoking finalize_request.

On Wed, Jul 24, 2019 at 4:14 PM Dk Jack <dnj0496 at gmail.com> wrote:

> Could someone comment on my question below. What does it mean when the
> connections are stuck in 'Writing' state? Since the client has received the
> response, why is the nginx still stuck trying to write something. Any help
> in debugging or what to look for is greatly appreciated. Thanks.
>
> Dk.
>
> On Tue, Jul 23, 2019 at 6:17 PM Dk Jack <dnj0496 at gmail.com> wrote:
>
>> Hi,
>> In my module, I am capturing the request body to check if the body
>> contains some specific content. If the body does not contain the specific
>> content, I pass on the request without modification. Otherwise, I send a
>> HTTP_FORBIDDEN. I am using 'ngx_http_read_client_request_body' call to
>> capture the body.  Everything seems to be working fine. My requests are
>> forwarded to the orgin server and my client is receiving the response from
>> the origin server correctly.
>>
>> However, what I notice is that the nginx is not releasing the client side
>> (see below). Nginx status module reports same number of active connections
>> in 'writing' state. Is there something special I need to do in my module to
>> ensure the connections are closed properly when I am capturing body? Any
>> help is greatly appreciated. Thanks.
>>
>> Regards,
>> Dk.
>>
>> [centos at ip-10-50-18-73 nginx]$ netstat -n | grep CLOSE_WAIT | head -4
>> tcp        1      0 10.50.18.73:443         10.50.30.239:60116
>>  CLOSE_WAIT
>> tcp        1      0 10.50.18.73:443         10.50.30.239:60092
>>  CLOSE_WAIT
>> tcp        1      0 10.50.18.73:443         10.50.30.239:60112
>>  CLOSE_WAIT
>> tcp        1      0 10.50.18.73:443         10.50.30.239:60054
>>  CLOSE_WAIT
>> [centos at ip-10-50-18-73 nginx]$ netstat -n | grep CLOSE_WAIT | wc -l
>> 35
>> [centos at ip-10-50-18-73 nginx]$ [centos at ip-10-50-18-73 nginx]$ curl -k
>> https://localhost/nginx_status
>> Active connections: 37
>> server accepts handled requests
>>  41 41 472
>> Reading: 0 Writing: 36 Waiting: 1
>> [centos at ip-10-50-18-73 nginx]$
>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20190724/de115f00/attachment.html>


More information about the nginx-devel mailing list