Fix some issues with closing subprocesses
This commit is contained in:
parent
8d730f07d9
commit
2a70fd9932
|
@ -21,4 +21,4 @@ TODO:
|
|||
|
||||
from .processes import *
|
||||
from .parallelizer import Parallelize, CanceledError
|
||||
from .remoteproxy import proxy
|
||||
from .remoteproxy import proxy, ClosedError, NoResultError
|
||||
|
|
|
@ -182,7 +182,8 @@ def startEventLoop(name, port, authkey, ppid, debug=False):
|
|||
HANDLER.processRequests() # exception raised when the loop should exit
|
||||
time.sleep(0.01)
|
||||
except ClosedError:
|
||||
break
|
||||
HANDLER.debugMsg('Exiting server loop.')
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
class ForkedProcess(RemoteEventHandler):
|
||||
|
|
|
@ -419,7 +419,7 @@ class RemoteEventHandler(object):
|
|||
if opts is None:
|
||||
opts = {}
|
||||
|
||||
assert callSync in ['off', 'sync', 'async'], 'callSync must be one of "off", "sync", or "async"'
|
||||
assert callSync in ['off', 'sync', 'async'], 'callSync must be one of "off", "sync", or "async" (got %r)' % callSync
|
||||
if reqId is None:
|
||||
if callSync != 'off': ## requested return value; use the next available request ID
|
||||
reqId = self.nextRequestId
|
||||
|
@ -572,6 +572,10 @@ class RemoteEventHandler(object):
|
|||
self.proxies[ref] = proxy._proxyId
|
||||
|
||||
def deleteProxy(self, ref):
|
||||
if self.send is None:
|
||||
# this can happen during shutdown
|
||||
return
|
||||
|
||||
with self.proxyLock:
|
||||
proxyId = self.proxies.pop(ref)
|
||||
|
||||
|
|
Loading…
Reference in New Issue