[PATCH 1 of 1] Fix for Nginx hanging on systems without EPOLLRDHUP

Marcus Ball marcus.ball at live.com
Thu Mar 3 19:07:27 UTC 2022


# HG changeset patch
# User Marcus Ball<marcus.ball at live.com>
# Date 1646329482 18000
#      Thu Mar 03 12:44:42 2022 -0500
# Node ID 395afc438f3ed064f78c6d8f1c3e5abe4d6294fc
# Parent  a736a7a613ea6e182ff86fbadcb98bb0f8891c0b
Add missing `ngx_use_epoll_rdhup` condition.

This fixes an issue where Nginx hangs when a response exceeding
the page size is being sent from an upstream server with
fastcgi_buffering enabled (such as from PHP-FPM).

This issue occurs on systems which support epoll, but which
do not support EPOLLRDHUP, like Digital Ocean's App Platform.

diff -r a736a7a613ea -r 395afc438f3e src/os/unix/ngx_readv_chain.c
--- a/src/os/unix/ngx_readv_chain.c	Tue Feb 08 17:35:27 2022 +0300
+++ b/src/os/unix/ngx_readv_chain.c	Thu Mar 03 12:44:42 2022 -0500
@@ -55,7 +55,9 @@
  
  #if (NGX_HAVE_EPOLLRDHUP)
  
-    if (ngx_event_flags & NGX_USE_EPOLL_EVENT) {
+    if ((ngx_event_flags & NGX_USE_EPOLL_EVENT)
+        && ngx_use_epoll_rdhup)
+    {
          ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0,
                         "readv: eof:%d, avail:%d",
                         rev->pending_eof, rev->available);
diff -r a736a7a613ea -r 395afc438f3e src/os/unix/ngx_recv.c
--- a/src/os/unix/ngx_recv.c	Tue Feb 08 17:35:27 2022 +0300
+++ b/src/os/unix/ngx_recv.c	Thu Mar 03 12:44:42 2022 -0500
@@ -52,7 +52,9 @@
  
  #if (NGX_HAVE_EPOLLRDHUP)
  
-    if (ngx_event_flags & NGX_USE_EPOLL_EVENT) {
+    if ((ngx_event_flags & NGX_USE_EPOLL_EVENT)
+        && ngx_use_epoll_rdhup)
+    {
          ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0,
                         "recv: eof:%d, avail:%d",
                         rev->pending_eof, rev->available);



More information about the nginx-devel mailing list