How does Gunicorn handle file descriptors? #3365
Unanswered
GuyShalomCyberRidge
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey! 😎
I have an app with an Nginx, Flask, Gunicorn & Gevent setup (1-worker).
Ever since we moved to using Gunicorn, we're encountering a weird issue:
When starting the server everything is working fine. However, gradually overtime, I see that the Gunicorn worker process makes more and more file descriptors all the time. This happens at a steady pace until after around 4-5 hours, the process exceeds Gevent's 1024 FD limit - Throwing a
filedescriptor out of range in select()
error and essentially killing the entire backend.This very well might be an implementation error by me, But I wasn't able to figure it out, and trying to debug the whole thing has been super difficult as I couldn't find an explanation online for how Gunicorn manages its FDs.
Can anyone explain Gunicorn's behaviour when handling FDs? A link to some docs would also be great.
I'm just missing basic ideas like:
Thanks in advance! 🙏
Versions used
Flask 2.2.5
Gunicorn 23.0.0
Gevent 24.11.1
Nginx 1.27.4
Beta Was this translation helpful? Give feedback.
All reactions