forked from goodboy/tractor
1
0
Fork 0

Huh, maybe we don't need to block SIGINT

Seems like the request task cancel scope is actually solving all the
deadlock issues and masking SIGINT isn't changing much behaviour at all.
I think let's keep it unmasked for now in case it does turn out useful
in cancelling from unrecoverable states while in debug.
debug_tests
Tyler Goodlet 2020-09-28 13:11:22 -04:00
parent 25e93925b0
commit 5dd2d35fc5
1 changed files with 18 additions and 18 deletions

View File

@ -142,15 +142,15 @@ def handler(signum, frame):
pdbpp.pdb.Pdb.sigint_handler = handler
@contextmanager
def _disable_sigint():
try:
# disable sigint handling while in debug
prior_handler = signal.signal(signal.SIGINT, handler)
yield
finally:
# restore SIGINT handling
signal.signal(signal.SIGINT, prior_handler)
# @contextmanager
# def _disable_sigint():
# try:
# # disable sigint handling while in debug
# prior_handler = signal.signal(signal.SIGINT, handler)
# yield
# finally:
# # restore SIGINT handling
# signal.signal(signal.SIGINT, prior_handler)
async def _hijack_stdin_relay_to_child(
@ -162,7 +162,8 @@ async def _hijack_stdin_relay_to_child(
async with _acquire_debug_lock():
log.warning(f"Actor {subactor_uid} ACQUIRED stdin hijack lock")
with _disable_sigint():
# with _disable_sigint():
# indicate to child that we've locked stdio
yield 'Locked'
@ -218,7 +219,6 @@ def _breakpoint(debug_func) -> Awaitable[None]:
log.debug(f"Exiting debugger for actor {actor}")
global _in_debug
_in_debug = False
# actor.statespace['_in_debug'] = False
log.debug(f"Child {actor} released parent stdio lock")
async def _bp():
@ -226,7 +226,6 @@ def _breakpoint(debug_func) -> Awaitable[None]:
enters the ``pdbpp`` debugging console.
"""
global _in_debug
# in_debug = actor.statespace.setdefault('_in_debug', False)
if _in_debug:
# if **this** actor is already in debug mode block here
@ -241,7 +240,8 @@ def _breakpoint(debug_func) -> Awaitable[None]:
global _pdb_release_hook
_pdb_release_hook = do_unlock.set
# actor.statespace['_in_debug'] = True
# mark local actor as "in debug mode" to avoid recurrent
# entries/requests to the root process
_in_debug = True
# TODO: need a more robust check for the "root" actor