[nginx] svn commit: r4255 - in branches/stable-1.0: . src/http

igor at sysoev.ru igor at sysoev.ru
Tue Nov 1 14:13:25 UTC 2011


Author: is
Date: 2011-11-01 14:13:25 +0000 (Tue, 01 Nov 2011)
New Revision: 4255

Modified:
   branches/stable-1.0/
   branches/stable-1.0/src/http/ngx_http_copy_filter_module.c
   branches/stable-1.0/src/http/ngx_http_request.c
Log:
Merging r4195, r4196:

AIO related fixes:

*) Fix for connection drops with AIO.

   Connections serving content with AIO to fast clients were dropped with
   "client timed out" messages after send_timeout from response start.

*) Fix for socket leak with "aio sendfile" and "limit_rate".

   Second aio post happened when timer set by limit_rate expired while we have
   aio request in flight, resulting in "second aio post" alert and socket leak.
   
   The patch adds actual protection from aio calls with r->aio already set to
   aio sendfile code in ngx_http_copy_filter().  This should fix other cases
   as well, e.g. when sending buffered to disk upstream replies while still
   talking to upstream.
   
   The ngx_http_writer() is also fixed to handle the above case (though it's
   mostly optimization now).



Property changes on: branches/stable-1.0
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk:3960-3974,3977-3987,3991-3996,3998,4003-4007,4009-4013,4015-4018,4020,4023,4025-4027,4034-4065,4073,4077,4086-4090,4094-4102,4106-4108,4113-4114,4129-4137,4143,4147-4152,4154-4158,4177,4179,4182-4184,4186-4187,4190-4194,4199-4205,4207,4212,4219-4220,4229-4230,4232,4235,4237
   + /trunk:3960-3974,3977-3987,3991-3996,3998,4003-4007,4009-4013,4015-4018,4020,4023,4025-4027,4034-4065,4073,4077,4086-4090,4094-4102,4106-4108,4113-4114,4129-4137,4143,4147-4152,4154-4158,4177,4179,4182-4184,4186-4187,4190-4196,4199-4205,4207,4212,4219-4220,4229-4230,4232,4235,4237

Modified: branches/stable-1.0/src/http/ngx_http_copy_filter_module.c
===================================================================
--- branches/stable-1.0/src/http/ngx_http_copy_filter_module.c	2011-11-01 14:09:15 UTC (rev 4254)
+++ branches/stable-1.0/src/http/ngx_http_copy_filter_module.c	2011-11-01 14:13:25 UTC (rev 4255)
@@ -158,6 +158,11 @@
             ngx_file_t            *file;
             ngx_http_ephemeral_t  *e;
 
+            if (r->aio) {
+                c->busy_sendfile = NULL;
+                return rc;
+            }
+
             file = c->busy_sendfile->file;
             offset = c->busy_sendfile->file_pos;
 

Modified: branches/stable-1.0/src/http/ngx_http_request.c
===================================================================
--- branches/stable-1.0/src/http/ngx_http_request.c	2011-11-01 14:09:15 UTC (rev 4254)
+++ branches/stable-1.0/src/http/ngx_http_request.c	2011-11-01 14:13:25 UTC (rev 4255)
@@ -2248,17 +2248,17 @@
             return;
         }
 
-    } else {
-        if (wev->delayed || r->aio) {
-            ngx_log_debug0(NGX_LOG_DEBUG_HTTP, wev->log, 0,
-                           "http writer delayed");
+    }
 
-            if (ngx_handle_write_event(wev, clcf->send_lowat) != NGX_OK) {
-                ngx_http_close_request(r, 0);
-            }
+    if (wev->delayed || r->aio) {
+        ngx_log_debug0(NGX_LOG_DEBUG_HTTP, wev->log, 0,
+                       "http writer delayed");
 
-            return;
+        if (ngx_handle_write_event(wev, clcf->send_lowat) != NGX_OK) {
+            ngx_http_close_request(r, 0);
         }
+
+        return;
     }
 
     rc = ngx_http_output_filter(r, NULL);
@@ -2274,7 +2274,7 @@
 
     if (r->buffered || r->postponed || (r == r->main && c->buffered)) {
 
-        if (!wev->ready && !wev->delayed) {
+        if (!wev->delayed) {
             ngx_add_timer(wev, clcf->send_timeout);
         }
 



More information about the nginx-devel mailing list