-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
Fix uWSGI configuration for clean shutdown #46
Conversation
Just making sure I understand the patch correctly: why is consul-template attempting to restart the whole process? AFAIK, when a template changes, consul-template should only send
Won't that cause requests to fail intermittently while uWSGI is restarting? uWSGI apparently supports graceful reloads via SIGHUP, and this would seem to bypass that. |
There was a gap in my understanding and the terminology I used in the above explanation was a bit vague. Here's a clearer and more accurate explanation:
This is fixed by adding However now I am curious why consul-template misleading believes that uWSGI has exited when it is reloading. |
For record, we figured why this was happening: https://chatlogs.metabrainz.org/libera/metabrainz/2023-11-22/?msg=5253309&page=1 |
We fixed the `bind(): Address already in use [core/socket.c line 769]` error in LB using `exit-on-reload = true` in uWSGI configuration. However, this prevents graceful reloading. I did some further investigation as noted in metabrainz/artwork-redirect#46 and have a better fix in mind now. For the command field in `exec` block of consul template configuration, use array format. This executes the command directly without spawning a shell wrapper or setting a process group id. Both of which will interfere with forwarding signals to the uWSGI process.
We fixed the `bind(): Address already in use [core/socket.c line 769]` error in LB using `exit-on-reload = true` in uWSGI configuration. However, this prevents graceful reloading. I did some further investigation as noted in metabrainz/artwork-redirect#46 and have a better fix in mind now. For the command field in exec block of consul template configuration, use array format. This executes the command directly without spawning a shell wrapper or setting a process group id. Both of which will interfere with forwarding signals to the uWSGI process.
We fixed the `bind(): Address already in use [core/socket.c line 769]` error in LB using `exit-on-reload = true` in uWSGI configuration. However, this prevents graceful reloading. I did some further investigation as noted in metabrainz/artwork-redirect#46 and have a better fix in mind now. For the command field in exec block of consul template configuration, use array format. This executes the command directly without spawning a shell wrapper or setting a process group id. Both of which will interfere with forwarding signals to the uWSGI process.
We fixed the `bind(): Address already in use [core/socket.c line 769]` error in LB using `exit-on-reload = true` in uWSGI configuration. However, this prevents graceful reloading. I did some further investigation as noted in metabrainz/artwork-redirect#46 and have a better fix in mind now. For the command field in exec block of consul template configuration, use array format. This executes the command directly without spawning a shell wrapper or setting a process group id. Both of which will interfere with forwarding signals to the uWSGI process.
We fixed the `bind(): Address already in use [core/socket.c line 769]` error in LB using `exit-on-reload = true` in uWSGI configuration. However, this prevents graceful reloading. I did some further investigation as noted in metabrainz/artwork-redirect#46 and have a better fix in mind now. For the command field in exec block of consul template configuration, use array format. This executes the command directly without spawning a shell wrapper or setting a process group id. Both of which will interfere with forwarding signals to the uWSGI process.
We fixed the `bind(): Address already in use [core/socket.c line 769]` error in LB using `exit-on-reload = true` in uWSGI configuration. However, this prevents graceful reloading. I did some further investigation as noted in metabrainz/artwork-redirect#46 and have a better fix in mind now. For the command field in `exec` block of consul template configuration, use array format. This executes the command directly without spawning a shell wrapper or setting a process group id. Both of which will interfere with forwarding signals to the uWSGI process.
We fixed the `bind(): Address already in use [core/socket.c line 769]` error using `exit-on-reload = true` in uWSGI configuration. However, this prevents graceful reloading. I did some further investigation as noted in metabrainz/artwork-redirect#46 and have a better fix in mind now. For the command field in exec block of consul template configuration, use array format. This executes the command directly without spawning a shell wrapper or setting a process group id. Both of which will interfere with forwarding signals to the uWSGI process. This also needs a newer version of consul-template. So upgrading to a newer base image.
We fixed the `bind(): Address already in use [core/socket.c line 769]` error using `exit-on-reload = true` in uWSGI configuration. However, this prevents graceful reloading. I did some further investigation as noted in metabrainz/artwork-redirect#46 and have a better fix in mind now. For the command field in exec block of consul template configuration, use array format. This executes the command directly without spawning a shell wrapper or setting a process group id. Both of which will interfere with forwarding signals to the uWSGI process. This also needs a newer version of consul-template. So upgrading to a newer base image.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for your detailed investigation into this!
As per investigation, we can remove exit-on-reload and use the array form of the command to ensure proper signal handling on reloads.
In absence of the exit-on-reload configuration option, uWSGI does not exit cleanly when consul-template attempts to restart it. This manifests as an error like:
bind(): Address already in use [core/socket.c line 769]
. Fix the configuration appropriately.