forked from goodboy/tractor
Test non-shielding root lock acquire on breakpoint entry
parent
86f4f2df6f
commit
d6ddc47e58
|
@ -254,6 +254,7 @@ async def _hijack_stdin_for_child(
|
||||||
# assert await stream.receive() == 'pdb_unlock'
|
# assert await stream.receive() == 'pdb_unlock'
|
||||||
|
|
||||||
except (
|
except (
|
||||||
|
trio.MultiError,
|
||||||
trio.BrokenResourceError,
|
trio.BrokenResourceError,
|
||||||
trio.Cancelled, # by local cancellation
|
trio.Cancelled, # by local cancellation
|
||||||
trio.ClosedResourceError, # by self._rx_chan
|
trio.ClosedResourceError, # by self._rx_chan
|
||||||
|
@ -343,6 +344,7 @@ async def _breakpoint(
|
||||||
|
|
||||||
except tractor.ContextCancelled:
|
except tractor.ContextCancelled:
|
||||||
log.warning('Root actor cancelled debug lock')
|
log.warning('Root actor cancelled debug lock')
|
||||||
|
raise
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
log.debug(f"Exiting debugger for actor {actor}")
|
log.debug(f"Exiting debugger for actor {actor}")
|
||||||
|
@ -407,10 +409,14 @@ async def _breakpoint(
|
||||||
'Root actor attempting to shield-acquire active tty lock'
|
'Root actor attempting to shield-acquire active tty lock'
|
||||||
f' owned by {_global_actor_in_debug}')
|
f' owned by {_global_actor_in_debug}')
|
||||||
|
|
||||||
with trio.CancelScope(shield=True):
|
stats = _debug_lock.statistics()
|
||||||
# must shield here to avoid hitting a ``Cancelled`` and
|
if stats.owner:
|
||||||
# a child getting stuck bc we clobbered the tty
|
breakpoint()
|
||||||
await _debug_lock.acquire()
|
|
||||||
|
# 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()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# may be cancelled
|
# may be cancelled
|
||||||
|
|
Loading…
Reference in New Issue