]> git.kaiwu.me - nginx.git/commit
Fix for socket leak with "aio sendfile" and "limit_rate".
authorMaxim Dounin <mdounin@mdounin.ru>
Tue, 11 Oct 2011 18:00:23 +0000 (18:00 +0000)
committerMaxim Dounin <mdounin@mdounin.ru>
Tue, 11 Oct 2011 18:00:23 +0000 (18:00 +0000)
commit0f5f4cb1805e70c8fab3bcd13e18ad24670b47ba
treedc6f50cbf63af9a9fe92317497f83910f1aeef1d
parentb7af402cc40136db0a7b03af6a380eb405cb0910
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).

Reported by Oleksandr V. Typlyns'kyi.
src/http/ngx_http_copy_filter_module.c
src/http/ngx_http_request.c