forked from goodboy/tractor
1
0
Fork 0
tractor/tractor
Tyler Goodlet 8477d21499 Restructure actor runtime nursery scoping
In an effort acquire more deterministic actor cancellation,
this adds a clearer and more resilient (whilst possibly a bit
slower) internal nursery structure with explicit semantics for
clarifying the task-scope shutdown sequence.

Namely, on cancellation, the explicit steps are now:
- cancel all currently running rpc tasks and wait
  for them to complete
- cancel the channel server and wait for it to complete
- cancel the msg loop for the channel with the immediate parent
- de-register with arbiter if possible
- wait on remaining connections to release
- exit process

To accomplish this add a new nursery called the "service nursery" which
spawns all rpc tasks **instead of using** the "root nursery". The root
is now used solely for async launching the msg loop for the primary
channel with the parent such that it is (nearly) the last thing torn
down on cancellation.

In the future it should also be possible to have `self.cancel()` return
a result to the parent once the runtime is sure that the rest of the
shutdown is atomic; this would allow for a true unbounded shield in
`Portal.cancel_actor()`. This will likely require that the error
handling blocks in `Actor._async_main()` are moved "inside" the root
nursery block such that the msg loop with the parent truly is the last
thing to terminate.
2020-08-08 14:55:41 -04:00
..
testing First attempt at removing trip & updating hazmat -> lowlevel 2020-07-24 17:08:52 -04:00
__init__.py Get entry points reorg without asyncio compat 2020-07-24 17:02:03 -04:00
_actor.py Restructure actor runtime nursery scoping 2020-08-08 14:55:41 -04:00
_child.py Docstring to the top\!, and redundant spaces goodbye\! 2020-07-29 15:39:38 -03:00
_discovery.py Log on KBI cancelled termination 2020-08-03 18:46:18 -04:00
_entry.py Log on KBI cancelled termination 2020-08-03 18:46:18 -04:00
_exceptions.py Expose trio exceptions to `RemoteActorError` 2019-10-30 00:32:10 -04:00
_forkserver_override.py Continue hacking the forkserver in Python 3.8 2019-10-15 22:37:47 -04:00
_ipc.py Allow for tuple keys with std `msgpack` 2020-08-03 18:41:21 -04:00
_mp_fixup_main.py Do __main__ fixups like ``mulitprocessing does`` 2020-01-29 21:14:48 -05:00
_portal.py Allow shielding in `open_portal()` 2020-08-08 14:47:52 -04:00
_spawn.py Harden `trio` spawner process waiting 2020-08-08 14:43:25 -04:00
_state.py First attempt at removing trip & updating hazmat -> lowlevel 2020-07-24 17:08:52 -04:00
_streaming.py Validate stream functions at decorate time 2019-03-29 19:10:32 -04:00
_trionics.py Correctly catch cancelled nursery case (purely for logging) 2020-08-03 18:44:50 -04:00
log.py Allow overriding the root logger name 2019-12-20 16:37:17 -05:00
msg.py Validate stream functions at decorate time 2019-03-29 19:10:32 -04:00