[nginx] Fixed deferred accept with EPOLLRDHUP enabled (ticket #1278).

Maxim Dounin mdounin at mdounin.ru
Tue Oct 17 13:06:40 UTC 2017

details:   http://hg.nginx.org/nginx/rev/0e05b35beebf
branches:  stable-1.12
changeset: 7137:0e05b35beebf
user:      Roman Arutyunyan <arut at nginx.com>
date:      Wed May 24 13:17:08 2017 +0300
Fixed deferred accept with EPOLLRDHUP enabled (ticket #1278).

Previously, the read event of the accepted connection was marked ready, but not
available.  This made EPOLLRDHUP-related code (for example, in ngx_unix_recv())
expect more data from the socket, leading to unexpected behavior.

For example, if SSL, PROXY protocol and deferred accept were enabled on a listen
socket, the client connection was aborted due to unexpected return value of


 src/event/ngx_event_accept.c |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff --git a/src/event/ngx_event_accept.c b/src/event/ngx_event_accept.c
--- a/src/event/ngx_event_accept.c
+++ b/src/event/ngx_event_accept.c
@@ -238,7 +238,7 @@ ngx_event_accept(ngx_event_t *ev)
         if (ev->deferred_accept) {
             rev->ready = 1;
             rev->available = 1;

More information about the nginx-devel mailing list