-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error 502 after gunicorn worker auto-restart #14691
Comments
There are a few points to consider here:
All this is to say I'm not sure where I stand on the proposal. I think my biggest issue with it is that forcing a downgrade of gunicorn on the next NetBox release could potentially cause more problems for some users than the bug at issue here. This puts us in a difficult position. |
I fully understand that downgrading may not be an option, especially if we lose Python 3.11 support. |
I suppose it's worth explicitly calling out the workaround for anyone who happens upon this issue: Gunicorn can be downgraded to v20.1.0 for an existing NetBox deployment using
|
Debian 12 (on which I plan to run all my NetBox 3.7.x setups) has Python 3.11, so I'm really interested in this issue. Currently trying to find out what the "Python 3.11 support" mentioned in Gunicorn 21.x actually means. |
FWIW I don't expect that earlier versions of gunicorn won't work on Python 3.11, just that they aren't specifically supported (or tested). |
Would this work-around be a way forward for me, in this problem I have described here: #14730 ? |
Maybe. You should look into your
there. |
And I do.
If I'm honest, gunicorn 21.2.0 doesn't really seem production ready, if this is the behavior we can expect. |
Note that gunicorn's autorestart itself is expected and desired (as investigated in earlier NetBox issues, search here for max_requests), but it behaves differently in gunicorn 21.2.0, causing resets in connections. In any case, supporting the issue at benoitc/gunicorn#3038 is probably the way to affect gunicorn. |
Sure, I should have added that these autorestarts should correlate with the 502s that are observed. |
I have been testing a few things and this is my finding. Example:
If I set the max_requests to 0, thus disabling it, my scripts work. without error. But is this preferable to having gunicorn processes restart regularly. I suppose it would start consuming memory, if it has memory-leak errors that is. Perhaps a scheduled restart of the Netbox and netbox-rq services once a day would do the trick? |
I have come to the conclusion, that rather than downgrade gunicorn of maybe loose some necessary features, I will go ahead with max_requests set i 0 and if memory usage becomes an issue on the server I will set up a scheduled job that restarts the worker processes with this command:
|
We ran into this issue as well. We have several scripts using the NetBox API, and they began having intermittent issues after the gunicorn upgrade to 21.2.0. We've been downgrading to 20.1.0 which works flawlessly. Recently did an in-place upgrade from Debian 11 to 12 and everything is still working smooth with 20.1.0 and NB 3.7.0. |
I'd appreciate observations:
Unfortunately my current prod NetBoxes are 3.3.x so its no use doing this there, and my 3.7.0 test boxes don't get nearly enough of legitime use to tell if the gunicorn instances are still leaking memory or not. |
I'll just add that I've been running NetBox using |
I see NetBox maintainers also mentioned uWSGI in their meeting: #14777 Do you want to share your uWSGI configs and relevant systemd (etc) files? It's totally new area for me, even though I know how gunicorn+systemd combo works. |
Discussion #14780 opened about uWSGI configuration |
We've added a note in the installation docs for now. Will keep an eye on this; hoping for a new gunicorn release soon. 🤞 |
Deployment Type
Self-hosted
NetBox Version
v3.7.0
Python Version
3.9
Steps to Reproduce
This is a know issue with gunicorn that was introduced with the update of the gunicorn version in NetBox v3.5.7. Steps to reproduce can be found at benoitc/gunicorn#3038. Also some NetBox users are reporting these errors since v3.5.7 in that issue.
Expected Behavior
I do not expect to get an error 502 for common requests without an actual fault.
Observed Behavior
I get an error 502 when multiple sequential requests are sent to gunicorn with the default gunicorn version and configuration.
As there is not much happening with the gunicorn issue and pull request, I would like to suggest to downgrade gunicorn to version 20.1.0.
The text was updated successfully, but these errors were encountered: