forked from goodboy/tractor
1
0
Fork 0
tractor/tractor
Tyler Goodlet 0956d5f461 Restore the `trio` SIGINT handler, cancel root lock tasks on no-peers
Pretty sure this is the final touch to alleviate all our debug lock
headaches! Instead of trying to revert to the "last" handler (as `pdb`
does internally in the stdlib) we always just revert to the handler
`trio` registers during startup. Further this seems to allow cancelling
the root-side locking task if it's detected as stale IFF we only do this
when the root actor is in a "no more IPC peers" state.

Deatz:
- (always) set `._debug.Lock._trio_handler` as the `trio` version, not
  some last used handler to make sure we're getting the ctrl-c handling
  we want when not in debug mode.
- assign the trio handler in `open_root_actor()`
  `._runtime._async_main()` to be sure it's applied in subactors as well
  as the root.
- only do debug lock blocking and root-side-locking-task cancels when
  a "no peers" condition is detected in the root actor: i.e. no IPC
  channels are detected by the root meaning it's impossible any actor
  has a sane lock-state ongoing for debug mode.
2022-10-14 18:18:01 -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 First pass, swap `MultiError` for `BaseExceptionGroup` 2022-10-14 18:16:51 -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 Restore the `trio` SIGINT handler, cancel root lock tasks on no-peers 2022-10-14 18:18:01 -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 Hide some stack layers the user doesn't really need to see 2022-10-14 18:18:01 -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 Hide some stack layers the user doesn't really need to see 2022-10-14 18:18:01 -04:00
_root.py Restore the `trio` SIGINT handler, cancel root lock tasks on no-peers 2022-10-14 18:18:01 -04:00
_runtime.py Restore the `trio` SIGINT handler, cancel root lock tasks on no-peers 2022-10-14 18:18:01 -04:00
_spawn.py Hide some stack layers the user doesn't really need to see 2022-10-14 18:18:01 -04:00
_state.py First pass, swap `MultiError` for `BaseExceptionGroup` 2022-10-14 18:16:51 -04:00
_streaming.py Support debug-lock blocking, use on no-more IPC 2022-10-11 20:00:05 -04:00
_supervise.py Pack error from the parent task into the actor nursery 2022-10-14 18:16:51 -04:00
log.py Move logging context map into `log.py` module 2022-10-12 12:46:20 -04: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