[PATCH] nginx does not close the connection for 412 responses under extreme conditions

agentzh agentzh at gmail.com
Sat May 12 12:17:16 UTC 2012


On Sat, May 12, 2012 at 4:50 PM, Maxim Dounin <mdounin at mdounin.ru> wrote:
>>
>> This issue can be reproduced with the standard ngx_http_static_module
>> serving the sample index.html page.
>
> Could you please clarify steps to reproduce you've used?  The only
> way I see is to redirect 412 error to an uncached static file with
> aio used, thus causing r->blocked to be set during request
> finalization.
>

I didn't enable aio. I used the mockeagain tool to emulate networks
that are extremely slow to write:

    https://github.com/agentzh/mockeagain

Then the debug logs look like below:

      1 2012/05/12 20:14:01 [debug] 2770#0: *1 http finalize request:
-2, "/index.html?" a:1, c:2
      2 2012/05/12 20:14:01 [debug] 2770#0: *1 http finalize request:
-4, "/index.html?" a:1, c:2
      3 2012/05/12 20:14:01 [debug] 2770#0: *1 http writer handler:
"/index.html?"
      4 2012/05/12 20:14:01 [debug] 2770#0: *1 http writer output
filter: -2, "/index.html?"
      5 2012/05/12 20:14:01 [debug] 2770#0: *1 http writer handler:
"/index.html?"
      6 2012/05/12 20:14:01 [debug] 2770#0: *1 http writer output
filter: -2, "/index.html?"
      7 2012/05/12 20:14:01 [debug] 2770#0: *1 http writer handler:
"/index.html?"
      8 2012/05/12 20:14:01 [debug] 2770#0: *1 http writer output
filter: -2, "/index.html?"
      9 2012/05/12 20:14:01 [debug] 2770#0: *1 http writer handler:
"/index.html?"
     10 2012/05/12 20:14:01 [debug] 2770#0: *1 http writer output
filter: -2, "/index.html?"
     [...]
    902 2012/05/12 20:14:01 [debug] 2770#0: *1 http writer output
filter: -2, "/index.html?"
    903 2012/05/12 20:14:01 [debug] 2770#0: *1 http writer handler:
"/index.html?"
    904 2012/05/12 20:14:01 [debug] 2770#0: *1 http writer output
filter: 0, "/index.html?"
    905 2012/05/12 20:14:01 [debug] 2770#0: *1 http writer done: "/index.html?"
    906 2012/05/12 20:14:01 [debug] 2770#0: *1 http finalize request:
0, "/index.html?" a:1, c:1
    907 2012/05/12 20:14:04 [debug] 2770#0: *1 http finalize request:
0, "/index.html?" a:1, c:1
    908 2012/05/12 20:14:04 [debug] 2770#0: *1 http finalize request:
0, "/index.html?" a:1, c:1
    909 2012/05/12 20:14:04 [debug] 2770#0: *1 http finalize request:
0, "/index.html?" a:1, c:1
    910 2012/05/12 20:14:04 [debug] 2770#0: *1 http finalize request:
0, "/index.html?" a:1, c:1
    911 2012/05/12 20:14:04 [debug] 2770#0: *1 http finalize request:
0, "/index.html?" a:1, c:1
    912 2012/05/12 20:14:04 [debug] 2770#0: *1 http finalize request:
0, "/index.html?" a:1, c:1
    [...]

That is, after all the response has been sent out via the http writer
handler, the ngx_http_finalize_request function is repeatedly being
called without terminating the connection.

Regards,
-agentzh



More information about the nginx-devel mailing list