mirror of
https://github.com/frappe/gunicorn.git
synced 2026-07-07 21:21:30 +08:00
Fix setproctitle initialization with systemd socket activation (#3465)
Force early setproctitle initialization by calling getproctitle() immediately after import. This ensures setproctitle captures the argv/environ memory layout before systemd.listen_fds() modifies the environment by removing LISTEN_FDS and LISTEN_PID. Without this fix, if LISTEN_FDS is the first environment variable, setproctitle fails to detect argv correctly and silently fails. Fixes #3430
This commit is contained in:
parent
29830ccc2f
commit
bbae34b951
@ -53,7 +53,12 @@ if sys.platform == "darwin":
|
|||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
from setproctitle import setproctitle
|
from setproctitle import setproctitle, getproctitle
|
||||||
|
|
||||||
|
# Force early initialization before any os.environ modifications
|
||||||
|
# (e.g. removing LISTEN_FDS in systemd socket activation)
|
||||||
|
# https://github.com/benoitc/gunicorn/issues/3430
|
||||||
|
getproctitle()
|
||||||
|
|
||||||
def _setproctitle(title):
|
def _setproctitle(title):
|
||||||
setproctitle("gunicorn: %s" % title)
|
setproctitle("gunicorn: %s" % title)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user