Cancel root nursery to trigger failure

The real issue is if the root nursery gets cancelled prior to
de-registration with the arbiter. This doesn't seem easy to
reproduce by side effect of a KBI however that is how it was
discovered in practise.
dereg_on_channel_aclose
Tyler Goodlet 2020-08-07 11:34:17 -04:00
parent d2d8860dad
commit 3a868fec30
1 changed files with 11 additions and 4 deletions

View File

@ -237,9 +237,9 @@ def test_close_channel_explicit(
use_signal,
arb_addr,
):
"""Verify that closing a stream explicitly **before** the containing
nursery tears down also results in subactor(s) deregistering from the
arbiter.
"""Verify that closing a stream explicitly and killing the actor's
"root nursery" **before** the containing nursery tears down also
results in subactor(s) deregistering from the arbiter.
"""
async def streamer(agen):
async for item in agen:
@ -264,7 +264,14 @@ def test_close_channel_explicit(
finally:
# XXX: THIS IS THE KEY THING that happens
# **before** exiting the actor nursery block
# (i think?).
# Kill the root nursery thus resulting in
# normal arbiter channel ops to fail during
# teardown. It doesn't seem like this is
# reliably triggered by an external SIGINT.
tractor.current_actor()._root_nursery.cancel_scope.cancel()
# also kill off channels cuz why not
await agen1.aclose()
await agen2.aclose()
finally: