The official NGINX Open Source repository.
Go to file
Maxim Dounin e66073c4d3 Upstream: fixed cache corruption and socket leaks with aio_write.
The ngx_event_pipe() function wasn't called on write events with
wev->delayed set.  As a result, threaded writing results weren't
properly collected in ngx_event_pipe_write_to_downstream() when a
write event was triggered for a completed write.

Further, this wasn't detected, as p->aio was reset by a thread completion
handler, and results were later collected in ngx_event_pipe_read_upstream()
instead of scheduling a new write of additional data.  If this happened
on the last reading from an upstream, last part of the response was never
written to the cache file.

Similar problems might also happen in case of timeouts when writing to
client, as this also results in ngx_event_pipe() not being called on write
events.  In this scenario socket leaks were observed.

Fix is to check if p->writing is set in ngx_event_pipe_read_upstream(), and
therefore collect results of previous write operations in case of read events
as well, similar to how we do so in ngx_event_pipe_write_downstream().
This is enough to fix the wev->delayed case.  Additionally, we now call
ngx_event_pipe() from ngx_http_upstream_process_request() if there are
uncollected write operations (p->writing and !p->aio).  This also fixes
the wev->timedout case.
2017-01-20 21:14:19 +03:00
auto Win32: compatiblity with OpenSSL 1.1.0. 2016-12-24 18:01:14 +03:00
conf Added the REQUEST_SCHEME parameter. 2015-06-05 22:23:26 +03:00
contrib Contrib: added 'commentstring' for vim-commentary support. 2016-12-13 00:49:44 +01:00
docs Year 2017. 2017-01-10 17:13:06 +03:00
misc Win32: added a variable to specify compiler. 2016-12-24 18:01:14 +03:00
src Upstream: fixed cache corruption and socket leaks with aio_write. 2017-01-20 21:14:19 +03:00
.hgtags release-1.11.8 tag 2016-12-27 17:23:08 +03:00