mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-08 19:26:48 +00:00
fix(wsgi): only install SIGCHLD handler from the main thread
runserver imports the WSGI application from a worker thread, where signal.signal() raises ValueError and the dev server fails to start. Gunicorn imports it from the worker's main thread, so production keeps reaping child processes as before.
This commit is contained in:
parent
a3a6961155
commit
0f362f697c
1 changed files with 6 additions and 1 deletions
|
|
@ -8,7 +8,12 @@ https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/
|
|||
"""
|
||||
|
||||
import signal
|
||||
signal.signal(signal.SIGCHLD, signal.SIG_IGN)
|
||||
import threading
|
||||
|
||||
# Reap child processes to avoid zombies. Signal handlers can only be set from
|
||||
# the main thread; runserver imports this module from a worker thread.
|
||||
if threading.current_thread() is threading.main_thread():
|
||||
signal.signal(signal.SIGCHLD, signal.SIG_IGN)
|
||||
|
||||
import os
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue