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
parent
d2d8860dad
commit
3a868fec30
|
@ -237,9 +237,9 @@ def test_close_channel_explicit(
|
||||||
use_signal,
|
use_signal,
|
||||||
arb_addr,
|
arb_addr,
|
||||||
):
|
):
|
||||||
"""Verify that closing a stream explicitly **before** the containing
|
"""Verify that closing a stream explicitly and killing the actor's
|
||||||
nursery tears down also results in subactor(s) deregistering from the
|
"root nursery" **before** the containing nursery tears down also
|
||||||
arbiter.
|
results in subactor(s) deregistering from the arbiter.
|
||||||
"""
|
"""
|
||||||
async def streamer(agen):
|
async def streamer(agen):
|
||||||
async for item in agen:
|
async for item in agen:
|
||||||
|
@ -264,7 +264,14 @@ def test_close_channel_explicit(
|
||||||
finally:
|
finally:
|
||||||
# XXX: THIS IS THE KEY THING that happens
|
# XXX: THIS IS THE KEY THING that happens
|
||||||
# **before** exiting the actor nursery block
|
# **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 agen1.aclose()
|
||||||
await agen2.aclose()
|
await agen2.aclose()
|
||||||
finally:
|
finally:
|
||||||
|
|
Loading…
Reference in New Issue