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

Marcus Ball marcus.ball at live.com
Thu Mar 3 19:04:21 UTC 2022


Hello,

I recently encountered an issue where Nginx would hang for a very long 
time, if not indefinitely, on responses which exceeded the FastCGI 
buffer size (> ~4000 bytes) from an upstream source which, in this case, 
was PHP-FPM. This issue appeared to only be happening on DigitalOcean's 
App Platform service; I couldn't reproduce it locally. I did a lot of 
testing and digging around, I eventually tracked it back to 
DigitalOcean's system not supporting the `EPOLLRDHUP` event. After much 
debugging and reading through Nginx's source code, I believe I found the 
source to be two conditions which were missing a check for 
`ngx_use_epoll_rdhup`. I made the changes and rebuilt nginx and 
everything appears to be working fine now.

If anyone needs to reproduce the issue, I've published a basic example 
at https://github.com/marcusball/nginx-epoll-bug. There are also 
corresponding Docker Hub images which should be able to demonstrate an 
example project with the bug and with the fix if they are deployed to 
App Platform: `marcusball/nginx-rdhup-bug:without-fix` and 
`marcusball/nginx-rdhup-bug:with-fix` respectively.


This is my first time contributing to Nginx, as well as the first time 
trying to contribute via mailing list, so let me know if anything else 
is needed. I also can't get the Mercurial Patchbomb extension working, 
so I'm sending this manually and my apologies if anything gets formatted 
incorrectly.


Marcus Ball



More information about the nginx-devel mailing list