Mk `test_crash_handler_cms` suite go green
Turns out there were some subtle internal bugs discovered by the just added `tests/devx/test_tooling::test_crash_handler_cms` suite. So this fixes, - a mis-ordering around `rt_repl_fixture :=` in the logic of `DebugStatus.maybe_enter_repl_fixture()`. - `.devx.debug._post_mortem._post_mortem()` ensuring we now **always** call `DebugStatus.release()`, and thus unwind the exist-stack managing the `repl_fixture` exit/teardown, **even in the case** where `yield False` is delivered from the user-fixture-fn (meaning `dnter_repl=False`) thus triggering an early `return` (as is done in the new test suite).main^2
parent
9ff448faa3
commit
f5056cdd02
|
@ -148,59 +148,61 @@ def _post_mortem(
|
||||||
repl_fixture=repl_fixture,
|
repl_fixture=repl_fixture,
|
||||||
boxed_maybe_exc=boxed_maybe_exc,
|
boxed_maybe_exc=boxed_maybe_exc,
|
||||||
)
|
)
|
||||||
if not enter_repl:
|
|
||||||
return
|
|
||||||
try:
|
try:
|
||||||
actor: Actor = current_actor()
|
if not enter_repl:
|
||||||
actor_repr: str = str(actor.uid)
|
# XXX, trigger `.release()` below immediately!
|
||||||
# ^TODO, instead a nice runtime-info + maddr + uid?
|
return
|
||||||
# -[ ] impl a `Actor.__repr()__`??
|
try:
|
||||||
# |_ <task>:<thread> @ <actor>
|
actor: Actor = current_actor()
|
||||||
|
actor_repr: str = str(actor.uid)
|
||||||
|
# ^TODO, instead a nice runtime-info + maddr + uid?
|
||||||
|
# -[ ] impl a `Actor.__repr()__`??
|
||||||
|
# |_ <task>:<thread> @ <actor>
|
||||||
|
|
||||||
except NoRuntime:
|
except NoRuntime:
|
||||||
actor_repr: str = '<no-actor-runtime?>'
|
actor_repr: str = '<no-actor-runtime?>'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
task_repr: Task = trio.lowlevel.current_task()
|
task_repr: Task = trio.lowlevel.current_task()
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
task_repr: str = '<unknown-Task>'
|
task_repr: str = '<unknown-Task>'
|
||||||
|
|
||||||
# TODO: print the actor supervion tree up to the root
|
# TODO: print the actor supervion tree up to the root
|
||||||
# here! Bo
|
# here! Bo
|
||||||
log.pdb(
|
log.pdb(
|
||||||
f'{_crash_msg}\n'
|
f'{_crash_msg}\n'
|
||||||
f'x>(\n'
|
f'x>(\n'
|
||||||
f' |_ {task_repr} @ {actor_repr}\n'
|
f' |_ {task_repr} @ {actor_repr}\n'
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# XXX NOTE(s) on `pdbp.xpm()` version..
|
# XXX NOTE(s) on `pdbp.xpm()` version..
|
||||||
#
|
#
|
||||||
# - seems to lose the up-stack tb-info?
|
# - seems to lose the up-stack tb-info?
|
||||||
# - currently we're (only) replacing this from `pdbp.xpm()`
|
# - currently we're (only) replacing this from `pdbp.xpm()`
|
||||||
# to add the `end=''` to the print XD
|
# to add the `end=''` to the print XD
|
||||||
#
|
#
|
||||||
print(traceback.format_exc(), end='')
|
print(traceback.format_exc(), end='')
|
||||||
caller_frame: FrameType = api_frame.f_back
|
caller_frame: FrameType = api_frame.f_back
|
||||||
|
|
||||||
# NOTE, see the impl details of these in the lib to
|
# NOTE, see the impl details of these in the lib to
|
||||||
# understand usage:
|
# understand usage:
|
||||||
# - `pdbp.post_mortem()`
|
# - `pdbp.post_mortem()`
|
||||||
# - `pdbp.xps()`
|
# - `pdbp.xps()`
|
||||||
# - `bdb.interaction()`
|
# - `bdb.interaction()`
|
||||||
repl.reset()
|
repl.reset()
|
||||||
repl.interaction(
|
repl.interaction(
|
||||||
frame=caller_frame,
|
frame=caller_frame,
|
||||||
# frame=None,
|
# frame=None,
|
||||||
traceback=tb,
|
traceback=tb,
|
||||||
)
|
)
|
||||||
|
finally:
|
||||||
# XXX NOTE XXX: this is abs required to avoid hangs!
|
# XXX NOTE XXX: this is abs required to avoid hangs!
|
||||||
#
|
#
|
||||||
# Since we presume the post-mortem was enaged to
|
# Since we presume the post-mortem was enaged to
|
||||||
# a task-ending error, we MUST release the local REPL request
|
# a task-ending error, we MUST release the local REPL request
|
||||||
# so that not other local task nor the root remains blocked!
|
# so that not other local task nor the root remains blocked!
|
||||||
DebugStatus.release()
|
DebugStatus.release()
|
||||||
|
|
||||||
|
|
||||||
async def post_mortem(
|
async def post_mortem(
|
||||||
|
|
|
@ -846,9 +846,9 @@ class DebugStatus:
|
||||||
|
|
||||||
'''
|
'''
|
||||||
if not (
|
if not (
|
||||||
repl_fixture
|
|
||||||
or
|
|
||||||
(rt_repl_fixture := _state._runtime_vars.get('repl_fixture'))
|
(rt_repl_fixture := _state._runtime_vars.get('repl_fixture'))
|
||||||
|
or
|
||||||
|
repl_fixture
|
||||||
):
|
):
|
||||||
return True # YES always enter
|
return True # YES always enter
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue