Fix worker signal.SIGTERM handler being installed from outside the main thread (#6176)

This commit is contained in:
Philipp Moritz
2019-11-20 11:14:28 -08:00
committed by GitHub
parent 0010382cc7
commit 33c768ebe4
+5 -1
View File
@@ -846,7 +846,11 @@ def sigterm_handler(signum, frame):
sys.exit(signal.SIGTERM)
signal.signal(signal.SIGTERM, sigterm_handler)
try:
signal.signal(signal.SIGTERM, sigterm_handler)
except ValueError:
logger.warning("Failed to set SIGTERM handler, processes might"
"not be cleaned up properly on exit.")
# Define a custom excepthook so that if the driver exits with an exception, we
# can push that exception to Redis.