]> git.kaiwu.me - nginx.git/commit
Prevented scheduling events on a shared connection.
authorRoman Arutyunyan <arut@nginx.com>
Mon, 14 Jan 2019 17:36:23 +0000 (20:36 +0300)
committerRoman Arutyunyan <arut@nginx.com>
Mon, 14 Jan 2019 17:36:23 +0000 (20:36 +0300)
commit36a0713244a28266beefd5703521949a5fa994ca
tree316721ea635289c05f938107f06238bc96f0e69d
parentb6b39b2fb9c66f2a05153bbc4fa770b9e3850491
Prevented scheduling events on a shared connection.

A shared connection does not own its file descriptor, which means that
ngx_handle_read_event/ngx_handle_write_event calls should do nothing for it.
Currently the c->shared flag is checked in several places in the stream proxy
module prior to calling these functions.  However it was not done everywhere.
Missing checks could lead to calling
ngx_handle_read_event/ngx_handle_write_event on shared connections.

The problem manifested itself when using proxy_upload_rate and resulted in
either duplicate file descriptor error (e.g. with epoll) or incorrect further
udp packet processing (e.g. with kqueue).

The fix is to set and reset the event active flag in a way that prevents
ngx_handle_read_event/ngx_handle_write_event from scheduling socket events.
src/event/ngx_event_udp.c
src/stream/ngx_stream_proxy_module.c