File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 44import os
55import queue
66import signal
7+ import threading
78import uuid
89import weakref
910from abc import ABC , abstractmethod
@@ -260,7 +261,14 @@ def sigusr1_handler(signum, frame):
260261 "down. See stack trace above for root cause issue." )
261262 kill_process_tree (os .getpid ())
262263
263- signal .signal (signal .SIGUSR1 , sigusr1_handler )
264+ if threading .current_thread () == threading .main_thread ():
265+ signal .signal (signal .SIGUSR1 , sigusr1_handler )
266+ else :
267+ logger .warning ("SIGUSR1 handler not installed because we are not "
268+ "running in the main thread. In this case the "
269+ "forked engine process may not be killed when "
270+ "an exception is raised, and you need to handle "
271+ "the engine process shutdown manually." )
264272
265273 # Serialization setup.
266274 self .encoder = MsgpackEncoder ()
You can’t perform that action at this time.
0 commit comments