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

Roman Arutyunyan arut at nginx.com
Wed May 24 10:19:01 UTC 2017


details:   http://hg.nginx.org/nginx/rev/3e2d90073adf
branches:  
changeset: 7005:3e2d90073adf
user:      Roman Arutyunyan <arut at nginx.com>
date:      Wed May 24 13:17:08 2017 +0300
description:
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
c->recv().

diffstat:

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

diffs (12 lines):

diff -r b624fbf7bee2 -r 3e2d90073adf src/event/ngx_event_accept.c
--- a/src/event/ngx_event_accept.c	Tue May 23 20:19:39 2017 +0300
+++ b/src/event/ngx_event_accept.c	Wed May 24 13:17:08 2017 +0300
@@ -238,7 +238,7 @@ ngx_event_accept(ngx_event_t *ev)
 
         if (ev->deferred_accept) {
             rev->ready = 1;
-#if (NGX_HAVE_KQUEUE)
+#if (NGX_HAVE_KQUEUE || NGX_HAVE_EPOLLRDHUP)
             rev->available = 1;
 #endif
         }


More information about the nginx-devel mailing list