From 28a6354e812819fa3b796cb06e1c6b863ff65beb Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sun, 10 Aug 2025 15:03:15 -0400 Subject: [PATCH] Set `shield` when `.cancel_called` for root crashes Such that we handle them despite a cancellation condition. This is almost always the case, that `root_tn.cancel_scope.cancel_called` is set, by the time the `debug._maybe_enter_pm()` hits. Previous I guess we just weren't actually ever REPL-debugging such cases? TODO, still needs a test obvi! --- tractor/_root.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tractor/_root.py b/tractor/_root.py index 370798dd..5ad1afb9 100644 --- a/tractor/_root.py +++ b/tractor/_root.py @@ -478,7 +478,10 @@ async def open_root_actor( # start runtime in a bg sub-task, yield to caller. async with ( - collapse_eg(), + collapse_eg( + # bp=True, + hide_tb=False, + ), trio.open_nursery() as root_tn, # XXX, finally-footgun below? @@ -523,6 +526,12 @@ async def open_root_actor( err, api_frame=inspect.currentframe(), debug_filter=debug_filter, + + # XXX NOTE, required to debug root-actor + # crashes under cancellation conditions; so + # most of them! + shield=root_tn.cancel_scope.cancel_called, + # ^TODO? write a (debugger) test for this ya? ) if (