forked from goodboy/tractor
1
0
Fork 0
tractor/tractor/devx
Tyler Goodlet 7656326484 Make `request_root_stdio_lock()` post-mortem-able
Finally got this working so that if/when an internal bug is introduced
to this request task-func, we can actually REPL-debug the lock request
task itself B)

As in, if the subactor's lock request task internally errors we,
- ensure the task always terminates (by calling `DebugStatus.release()`)
  and explicitly reports (via a `log.exception()`) the internal error.
- capture the error instance and set as a new `DebugStatus.req_err` and
  always check for it on final teardown - in which case we also,
 - ensure it's reraised from a new `DebugRequestError`.
 - unhide the stack frames for `_pause()`, `_enter_repl_sync()` so that
   the dev can upward inspect the `_pause()` call stack sanely.

Supporting internal impl changes,
- add `DebugStatus.cancel()` and `.req_err`.
- don't ever cancel the request task from
  `PdbREPL.set_[continue/quit]()` only when there's some internal error
  that would likely result in a hang and stale lock state with the root.
- only release the root's lock when the current ask is also the owner
  (avoids bad release errors).
- also show internal `._pause()`-related frames on any `repl_err`.

Other temp-dev-tweaks,
- make pld-dec change log msgs info level again while solving this
  final context-vars race stuff..
- drop the debug pld-dec instance match asserts for now since
  the problem is already caught (and now debug-able B) by an attr-error
  on the decoded-as-`dict` started msg, and instead add in
  a `log.exception()` trace to see which task is triggering the case
  where the debug `MsgDec` isn't set correctly vs. when we think it's
  being applied.
2025-03-24 14:04:51 -04:00
..
__init__.py Big debugger rework, more tolerance for internal err-hangs 2025-03-24 14:04:51 -04:00
_debug.py Make `request_root_stdio_lock()` post-mortem-able 2025-03-24 14:04:51 -04:00
_frame_stack.py Rework and first draft of `.devx._frame_stack.py` 2025-03-24 14:04:51 -04:00
_stackscope.py Use `log.devx()` for `stackscope` messages 2025-03-20 23:22:45 -04:00
cli.py Mk debugger tests work for arbitrary pre-REPL format 2025-03-20 15:07:27 -04:00
pformat.py Move `_debug.pformat_cs()` into `devx.pformat` 2025-03-24 14:04:51 -04:00