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 4
4
import os
5
5
import queue
6
6
import signal
7
+ import threading
7
8
import uuid
8
9
import weakref
9
10
from abc import ABC , abstractmethod
@@ -260,7 +261,14 @@ def sigusr1_handler(signum, frame):
260
261
"down. See stack trace above for root cause issue." )
261
262
kill_process_tree (os .getpid ())
262
263
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." )
264
272
265
273
# Serialization setup.
266
274
self .encoder = MsgpackEncoder ()
You can’t perform that action at this time.
0 commit comments