Test non-shielding root lock acquire on breakpoint entry

zombie_lord_infinite
Tyler Goodlet 2021-09-05 15:21:20 -04:00
parent 6da2c3a885
commit a2a4f7af09
1 changed files with 10 additions and 4 deletions
tractor

View File

@ -254,6 +254,7 @@ async def _hijack_stdin_for_child(
# assert await stream.receive() == 'pdb_unlock'
except (
trio.MultiError,
trio.BrokenResourceError,
trio.Cancelled, # by local cancellation
trio.ClosedResourceError, # by self._rx_chan
@ -343,6 +344,7 @@ async def _breakpoint(
except tractor.ContextCancelled:
log.warning('Root actor cancelled debug lock')
raise
finally:
log.debug(f"Exiting debugger for actor {actor}")
@ -407,7 +409,11 @@ async def _breakpoint(
'Root actor attempting to shield-acquire active tty lock'
f' owned by {_global_actor_in_debug}')
with trio.CancelScope(shield=True):
stats = _debug_lock.statistics()
if stats.owner:
breakpoint()
# with trio.CancelScope(shield=True):
# must shield here to avoid hitting a ``Cancelled`` and
# a child getting stuck bc we clobbered the tty
await _debug_lock.acquire()