Drop `debug_mode` gate on stackscope SIGUSR1
SIGUSR1 task-tree dumps via `stackscope` should work in
plain (non-pdb) runs too — esp. in infected-`asyncio`
processes where the kernel-default SIGUSR1 disposition is
`Term` (proc dies on `kill -USR1` w/o an installed
handler). Ungate the install path from `_debug_mode` in
both root and sub-actor init; the `use_stackscope` rt-var
+ `TRACTOR_ENABLE_STACKSCOPE` env-var checks remain as
the actual opt-in (e.g. via `--enable-stackscope`).
Deats,
- `_root.open_root_actor`: drop the `debug_mode and ...`
conjunction around the `enable_stack_on_sig()` call;
now gated only on the `enable_stack_on_sig` arg itself.
- `_runtime.Actor` sub-actor init: lift the
`use_stackscope`/`TRACTOR_ENABLE_STACKSCOPE` branch out
of the `if rvs['_debug_mode']:` block to peer-level.
The `use_greenback` branch stays inside `_debug_mode`
(pdb-specific).
- Refresh inline comments on both sites to call out the
infected-`asyncio` "default SIGUSR1 = terminate proc"
rationale.
(this patch was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
(cherry picked from commit 3d9c75b6ed)
wkt/tooling_enhancements_from_mtf_spawner
parent
cb04733e1d
commit
3a386ba511
|
|
@ -435,11 +435,12 @@ async def open_root_actor(
|
||||||
)
|
)
|
||||||
|
|
||||||
# TODO: factor this into `.devx._stackscope`!!
|
# TODO: factor this into `.devx._stackscope`!!
|
||||||
if (
|
#
|
||||||
debug_mode
|
# NOTE, intentionally NOT gated on `debug_mode` so SIGUSR1
|
||||||
and
|
# task-tree dumps work in plain (non-pdb) runs too — esp.
|
||||||
enable_stack_on_sig
|
# in infected-`asyncio` root processes where the default
|
||||||
):
|
# SIGUSR1 action would otherwise terminate the proc.
|
||||||
|
if enable_stack_on_sig:
|
||||||
from .devx._stackscope import enable_stack_on_sig
|
from .devx._stackscope import enable_stack_on_sig
|
||||||
enable_stack_on_sig()
|
enable_stack_on_sig()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -931,13 +931,18 @@ class Actor:
|
||||||
rvs: dict[str, Any] = spawnspec._runtime_vars
|
rvs: dict[str, Any] = spawnspec._runtime_vars
|
||||||
|
|
||||||
# `stackscope` SIGUSR1 handler: install when EITHER
|
# `stackscope` SIGUSR1 handler: install when EITHER
|
||||||
# `_debug_mode=True` (full multi-actor pdb support
|
# `use_stackscope` is set in rt-vars OR the
|
||||||
# path) OR the `TRACTOR_ENABLE_STACKSCOPE` env var
|
# `TRACTOR_ENABLE_STACKSCOPE` env var is set (lighter
|
||||||
# is set (lighter test-time hang-debug path; see
|
# test-time hang-debug path; see
|
||||||
# `tractor._testing.pytest`'s `--enable-stackscope`
|
# `tractor._testing.pytest`'s `--enable-stackscope`
|
||||||
# CLI flag — env var propagates via fork-inherited
|
# CLI flag — env var propagates via fork-inherited
|
||||||
# environ).
|
# environ).
|
||||||
if rvs['_debug_mode']:
|
#
|
||||||
|
# NOTE, intentionally NOT gated on `_debug_mode` so
|
||||||
|
# SIGUSR1 task-tree dumps work in plain (non-pdb)
|
||||||
|
# runs too — esp. in infected-`asyncio` sub-actors
|
||||||
|
# where the default SIGUSR1 action would otherwise
|
||||||
|
# terminate the proc.
|
||||||
if (
|
if (
|
||||||
rvs.get('use_stackscope')
|
rvs.get('use_stackscope')
|
||||||
or
|
or
|
||||||
|
|
@ -959,6 +964,7 @@ class Actor:
|
||||||
'debug mode / `--enable-stackscope`!'
|
'debug mode / `--enable-stackscope`!'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if rvs['_debug_mode']:
|
||||||
if rvs.get('use_greenback', False):
|
if rvs.get('use_greenback', False):
|
||||||
from ..devx import maybe_init_greenback
|
from ..devx import maybe_init_greenback
|
||||||
maybe_mod: ModuleType|None = await maybe_init_greenback()
|
maybe_mod: ModuleType|None = await maybe_init_greenback()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue