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

Maxim Dounin mdounin at mdounin.ru
Sat May 12 12:47:58 UTC 2012


Hello!

On Sat, May 12, 2012 at 08:17:16PM +0800, agentzh wrote:

> 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

I assume you use error_page to redirect 412, right?  You may want 
to show config (and more complete debug log) to simplify reading.

>       2 2012/05/12 20:14:01 [debug] 2770#0: *1 http finalize request:
> -4, "/index.html?" a:1, c:2

How this happens to be -4 (NGX_DONE)?  The NGX_ERROR is returned 
from ngx_http_filter_finalize_request(), and this is what should 
be used on ngx_http_finalize_request() call (unless some filter 
does wrong thing), resulting in ngx_terminate_request() call 
unless r->main->blocked is set.

[...]

Maxim Dounin



More information about the nginx-devel mailing list