1
0
Fork 0
tractor/tractor
Tyler Goodlet fb721f36ef Support debug-lock blocking, use on no-more IPC
This is a lingering debugger locking race case we needed to handle:

- child crashes acquires TTY lock in root and attaches to `pdb`
- child IPC goes down such that all channels to the root are broken
  / non-functional.
- root is stuck thinking the child is still in debug even though it
  can't be contacted and the child actor machinery hasn't been
  cancelled by its parent.
- root get's stuck in deadlock with child since it won't send a cancel
  request until the child is finished debugging, but the child can't
  unlock the debugger bc IPC is down.

To avoid this scenario add debug lock blocking list via
`._debug.Lock._blocked: set[tuple]` which holds actor uids for any actor
that is detected by the root as having no transport channel connections
with said root (of which at least one should exist if this sub-actor at
some point acquired the debug lock). The root consequently checks this
list for any actor that tries to (re)acquire the lock and blocks with
a `ContextCancelled`. When a debug condition is tested in
`._runtime._invoke` the context's `._enter_debugger_on_cancel` which
is set to `False` if the actor is on the block list in which case the
post-mortem entry is skipped.

Further this adds a root-locking-task side cancel scope to
`Lock._root_local_task_cs_in_debug` which can be cancelled by the root
runtime when a stale lock is detected after all IPC channels for the
actor have been torn down. NOTE: right now we're NOT doing this since it
seems to cause test failures likely due because it may cause pre-mature
cancellation and maybe needs a bit more experimenting?
2022-10-11 20:00:05 -04:00
..
experimental Use built-ins for all data-structure-type annotations 2022-09-15 23:41:28 -04:00
trionics Go back to a `global` single-ton nursery per actor 2022-10-09 21:27:23 -04:00
__init__.py Remove `tractor.run()` once and for all 2022-09-15 23:41:28 -04:00
_child.py Rename our core module to `_runtime` 2022-09-15 23:41:28 -04:00
_clustering.py Re-license code base for distribution under AGPL 2021-12-14 23:33:27 -05:00
_debug.py Support debug-lock blocking, use on no-more IPC 2022-10-11 20:00:05 -04:00
_discovery.py Use built-ins for all data-structure-type annotations 2022-09-15 23:41:28 -04:00
_entry.py 'Rename mp spawn methods to have a `'mp_'` prefix' 2022-10-09 17:54:55 -04:00
_exceptions.py Use built-ins for all data-structure-type annotations 2022-09-15 23:41:28 -04:00
_forkserver_override.py Re-license code base for distribution under AGPL 2021-12-14 23:33:27 -05:00
_ipc.py Use `str` | `bytes` union for typing msg dump 2022-07-12 11:59:11 -04:00
_mp_fixup_main.py Avoid importing mp for as long as possible 2022-02-17 11:55:26 -05:00
_portal.py Use one nursery per unique manager (signature) 2022-10-09 21:27:23 -04:00
_root.py Organize process spawning into lookup table 2022-10-09 16:51:21 -04:00
_runtime.py Support debug-lock blocking, use on no-more IPC 2022-10-11 20:00:05 -04:00
_spawn.py 'Rename mp spawn methods to have a `'mp_'` prefix' 2022-10-09 17:54:55 -04:00
_state.py Use built-ins for all data-structure-type annotations 2022-09-15 23:41:28 -04:00
_streaming.py Support debug-lock blocking, use on no-more IPC 2022-10-11 20:00:05 -04:00
_supervise.py Organize process spawning into lookup table 2022-10-09 16:51:21 -04:00
log.py Re-license code base for distribution under AGPL 2021-12-14 23:33:27 -05:00
msg.py Make `process_messages()` a mod func 2022-09-15 23:41:28 -04:00
to_asyncio.py Move `trio` scope outside first inter-task-chan receive 2022-10-11 20:00:05 -04:00