Welcome! Log In Create A New Profile

Advanced

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

agentzh
May 11, 2012 09:00AM
Hello!

I've just noticed that the "412 Precondition Failed page" for the
If-Unmodified-Since request header could lead to connection hang. That
is, when the 412 page cannot be sent out in a single run (seen EAGAIN
for example), then ngx_http_finalize_request will never close the
downstream connection due to the r->filter_finalize set by
ngx_http_filter_finalize_request.

This issue can be reproduced with the standard ngx_http_static_module
serving the sample index.html page.

Here attaches the patch for both nginx 1.0.15 to fix this (it should
also be applied to nginx 1.2.0, I think).

Comments welcome!

Thanks!
-agentzh

--- nginx-1.0.15/src/http/ngx_http_request.c 2012-03-05 20:49:32.000000000 +0800
+++ nginx-1.0.15-patched/src/http/ngx_http_request.c 2012-05-11
20:50:01.478111234 +0800
@@ -1900,6 +1900,7 @@

if (rc == NGX_OK && r->filter_finalize) {
c->error = 1;
+ ngx_http_finalize_connection(r);
return;
}
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

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

agentzh 1650 May 11, 2012 09:00AM

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

Maxim Dounin 600 May 12, 2012 04:52AM

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

agentzh 517 May 12, 2012 08:18AM

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

Maxim Dounin 552 May 12, 2012 08:50AM

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

agentzh 575 May 12, 2012 11:12AM

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

Maxim Dounin 621 May 12, 2012 01:14PM

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

Maxim Dounin 661 May 17, 2012 06:26AM

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

agentzh 604 May 17, 2012 06:50AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 223
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready