forked from goodboy/tractor
1
0
Fork 0

Unlock pdb tty on all possible net faults

alpha2
Tyler Goodlet 2021-08-31 17:46:00 -04:00
parent 79f0d6fda0
commit 61d2307e52
1 changed files with 8 additions and 1 deletions

View File

@ -253,7 +253,11 @@ async def _hijack_stdin_for_child(
# try: # try:
# assert await stream.receive() == 'pdb_unlock' # assert await stream.receive() == 'pdb_unlock'
except trio.BrokenResourceError: except (
trio.BrokenResourceError,
trio.Cancelled, # by local cancellation
trio.ClosedResourceError, # by self._rx_chan
) as err:
# XXX: there may be a race with the portal teardown # XXX: there may be a race with the portal teardown
# with the calling actor which we can safely ignore. # with the calling actor which we can safely ignore.
# The alternative would be sending an ack message # The alternative would be sending an ack message
@ -262,6 +266,9 @@ async def _hijack_stdin_for_child(
if lock and lock.locked(): if lock and lock.locked():
lock.release() lock.release()
if isinstance(err, trio.Cancelled):
raise
log.debug(f"TTY lock released, remote task: {task_name}:{subactor_uid}") log.debug(f"TTY lock released, remote task: {task_name}:{subactor_uid}")
return "pdb_unlock_complete" return "pdb_unlock_complete"