diff options
author | Igor Sysoev <igor@sysoev.ru> | 2011-11-01 14:13:25 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2011-11-01 14:13:25 +0000 |
commit | a1db86a30b82de2286d32f3ebf71de340d22e2d1 (patch) | |
tree | af652afea943d5dca11a2cf44e3ab3a8057b1154 /src/http/ngx_http_request.c | |
parent | 844ce56e348734b597ba9307dff2d5051a280b52 (diff) | |
download | nginx-a1db86a30b82de2286d32f3ebf71de340d22e2d1.tar.gz nginx-a1db86a30b82de2286d32f3ebf71de340d22e2d1.zip |
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).
Diffstat (limited to 'src/http/ngx_http_request.c')
-rw-r--r-- | src/http/ngx_http_request.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c index ac54b1f5a..c0d56ecaa 100644 --- a/src/http/ngx_http_request.c +++ b/src/http/ngx_http_request.c @@ -2248,17 +2248,17 @@ ngx_http_writer(ngx_http_request_t *r) 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 @@ ngx_http_writer(ngx_http_request_t *r) 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); } |