Opened 6 years ago

Closed 6 years ago

#1640 closed defect (worksforme)

Question on handling NGX_HTTP_CLIENT_CLOSED_REQUEST

Reported by: jcornez@… Owned by:
Priority: minor Milestone:
Component: nginx-core Version: 1.15.x
Keywords: Cc:
uname -a: Linux aws-staging-feed01 3.10.0-862.6.3.el7.x86_64 #1 SMP Tue Jun 26 16:32:21 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.13.9
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-4) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --with-http_ssl_module --with-cc-opt='-ggdb -O0 -fvar-tracking-assignments' --add-module=/tmp/nginx-temp-dir/nchan --prefix=/usr/local/nginx

Description

Hello and sorry if this is the wrong place to ask about this.

I'm looking at function ngx_http_request in ngx_httprequest.c

and specifically the following block of code.

    if (rc == NGX_ERROR
        || rc == NGX_HTTP_REQUEST_TIME_OUT
        || rc == NGX_HTTP_CLIENT_CLOSED_REQUEST
        || c->error)
    {
        if (ngx_http_post_action(r) == NGX_OK) {
            return;
        }

        ngx_http_terminate_request(r, rc);
        return;
    }

I'm very new to this code base, but it seems there is a chance to not call ngx_http_terminate_request when rc is NGX_HTTP_CLIENT_CLOSED_REQUEST. My understanding is that this is a 499 response indicating that the client has gone away. I think then that one *must* close the socket, else you get CLOSE_WAIT sockets accumulating.

I do have a case where CLOSE_WAIT appears to be accumulating (using the nchan module) and I'm just trying to better understand how this might be possible.

Thank you. Again sorry if this is the wrong forum or if I'm just completely incorrect about what is going on here.

-Jason

Change History (1)

comment:1 by Maxim Dounin, 6 years ago

Resolution: worksforme
Status: newclosed

This particular code always calls ngx_http_terminate_request() unless there is a post_action configured. If there is a post_action, nginx will terminate the request later, after the post action request completes.

In general, a better place to ask questions about nginx code is the nginx-devel@ mailing list.

Note: See TracTickets for help on using tickets.