-
Notifications
You must be signed in to change notification settings - Fork 68
Open
Description
Thespian/thespian/system/transport/MultiprocessQueueTransport.py
Lines 211 to 224 in 2341eae
try: | |
# Unfortunately, the Queue object is not signal-safe, | |
# so a frequent wakeup is needed to check | |
# _checkChildren and _shutdownSignalled. | |
rcvd = self._myInputQ.get(True, | |
min(run_time_f().view(ct).remainingSeconds() or | |
QUEUE_CHECK_PERIOD, | |
QUEUE_CHECK_PERIOD)) | |
except Q.Empty: | |
if not self._checkChildren and not self._shutdownSignalled: | |
# Probably a timeout, but let the while loop decide for sure | |
continue | |
rcvd = 'BuMP' | |
if rcvd == 'BuMP': |
After a KeyboardInterrupt
it's not possible to get Actors from the actor system or send messages to it, so the system can't be shut down properly any more.
Stacktrace
Process SpawnProcess-1:1:
Process ThespianAdmin:
Traceback (most recent call last):
File "D:\python\python37\lib\multiprocessing\process.py", line 297, in _bootstrap
self.run()
File "D:\python\python37\lib\multiprocessing\process.py", line 99, in run
self._target(*self._args, **self._kwargs)
File "D:\~\thespian\system\multiprocCommon.py", line 210, in startAdmin
admin.run()
File "D:\~\thespian\system\admin\convention.py", line 758, in run
delay.remaining())
File "D:\~\thespian\system\transport\wakeupTransportBase.py", line 71, in run
rval = self._run_subtransport(incomingHandler, max_runtime)
File "D:\~\thespian\system\transport\wakeupTransportBase.py", line 80, in _run_subtransport
rval = self._runWithExpiry(incomingHandler)
File "D:\~\thespian\system\transport\MultiprocessQueueTransport.py", line 697, in _runWithExpiry
lambda s=self: s.run_time)
File "D:\~\thespian\system\transport\MultiprocessQueueTransport.py", line 402, in core_receive
return self.core_common_receive(incoming_handler, my_address, run_time_f)[1]
File "D:\~\thespian\system\transport\MultiprocessQueueTransport.py", line 218, in core_common_receive
QUEUE_CHECK_PERIOD))
File "D:\python\python37\lib\multiprocessing\queues.py", line 104, in get
if not self._poll(timeout):
File "D:\python\python37\lib\multiprocessing\connection.py", line 257, in poll
return self._poll(timeout)
File "D:\python\python37\lib\multiprocessing\connection.py", line 330, in _poll
return bool(wait([self], timeout))
File "D:\python\python37\lib\multiprocessing\connection.py", line 869, in wait
ready_handles = _exhaustive_wait(waithandle_to_obj.keys(), timeout)
File "D:\python\python37\lib\multiprocessing\connection.py", line 801, in _exhaustive_wait
res = _winapi.WaitForMultipleObjects(L, False, timeout)
KeyboardInterrupt
Possible solution:
add
except KeyboardInterrupt:
continue
to ignore KeyboardInterrupts and keep the system running, so the thespian user can shut down the system properly. This change worked for me. Not sure if thespian would have to do any other stuff to do in this case or if there is a better place to catch/avoid the Exception.
Metadata
Metadata
Assignees
Labels
No labels