Skip to content

Commit

Permalink
Improve uWSGI and consul-template interactions on reloading
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
amCap1712 committed Nov 27, 2023
1 parent 71d724c commit 6f0a362
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docker/uwsgi/consul-template-uwsgi.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ template {
destination = "/code/consul_config.py"
}
exec {
command = "uwsgi --die-on-term /etc/uwsgi/uwsgi.ini"
command = ["uwsgi", "/etc/uwsgi/uwsgi.ini"]
splay = "60s"
reload_signal = "SIGHUP"
kill_signal = "SIGTERM"
Expand Down
5 changes: 2 additions & 3 deletions docker/uwsgi/uwsgi.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ processes = 20
disable-logging = true
; increase buffer size for requests that send a lot of mbids in query params
buffer-size = 8192
; when uwsgi gets a sighup, quit completely and let runit restart us
exit-on-reload = true
need-app = true
log-x-forwarded-for=true
log-x-forwarded-for = true
die-on-term = true

0 comments on commit 6f0a362

Please sign in to comment.