forked from goodboy/tractor
8ea0f08386
It's been a long time prepped and now finally implemented! Offer a `shield: bool` argument from our async `._debug` APIs: - `await tractor.pause(shield=True)`, - `await tractor.post_mortem(shield=True)` ^-These-^ can now be used inside cancelled `trio.CancelScope`s, something very handy when introspecting complex (distributed) system tear/shut-downs particularly under remote error or (inter-peer) cancellation conditions B) Thanks to previous prepping in a prior attempt and various patches from the rigorous rework of `.devx._debug` internals around typed msg specs, there ain't much that was needed! Impl deats - obvi passthrough `shield` from the public API endpoints (was already done from a prior attempt). - put ad-hoc internal `with trio.CancelScope(shield=shield):` around all checkpoints inside `._pause()` for both the root-process and subactor case branches. Add a fairly rigorous example, `examples/debugging/shielded_pause.py` with a wrapping `pexpect` test, `test_debugger.test_shield_pause()` and ensure it covers as many cases as i can think of offhand: - multiple `.pause()` entries in a loop despite parent scope cancellation in a subactor RPC task which itself spawns a sub-task. - a `trio.Nursery.parent_task` which raises, is handled and tries to enter and unshielded `.post_mortem()`, which of course internally raises `Cancelled` in a `._pause()` checkpoint, so we catch the `Cancelled` again and then debug the debugger's internal cancellation with specific checks for the particular raising checkpoint-LOC. - do ^- the latter -^ for both subactor and root cases to ensure we can debug `._pause()` itself when it tries to REPL engage from a cancelled task scope Bo |
||
---|---|---|
.. | ||
asyncio_bp.py | ||
debug_mode_hang.py | ||
fast_error_in_root_after_spawn.py | ||
multi_daemon_subactors.py | ||
multi_nested_subactors_error_up_through_nurseries.py | ||
multi_subactor_root_errors.py | ||
multi_subactors.py | ||
open_ctx_modnofound.py | ||
per_actor_debug.py | ||
pm_in_subactor.py | ||
restore_builtin_breakpoint.py | ||
root_actor_breakpoint.py | ||
root_actor_breakpoint_forever.py | ||
root_actor_error.py | ||
root_cancelled_but_child_is_in_tty_lock.py | ||
root_timeout_while_child_crashed.py | ||
shielded_pause.py | ||
subactor_bp_in_ctx.py | ||
subactor_breakpoint.py | ||
subactor_error.py | ||
sync_bp.py |