diff src/http/ngx_http_copy_filter_module.c @ 4254:35861ba428d1 stable-1.0

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).
author Igor Sysoev <igor@sysoev.ru>
date Tue, 01 Nov 2011 14:13:25 +0000
parents d29e8060ca0c
children d620f497c50f
line wrap: on
line diff
--- a/src/http/ngx_http_copy_filter_module.c
+++ b/src/http/ngx_http_copy_filter_module.c
@@ -158,6 +158,11 @@ ngx_http_copy_filter(ngx_http_request_t 
             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;