From ed9c359a1da606a0f082597b9f6760e30dac1259 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Mon, 7 Feb 2022 07:02:39 -0500 Subject: [PATCH] A `.open_context()` example that causes a hang! Finally! I think this may be the root issue we've been seeing in production in a client project. No idea yet why this is happening but the fault-causing sequence seems to be: - `.open_context()` in a child actor - enter the debugger via `tractor.breakpoint()` - continue from that entry via `c` command in REPL - raise an error just after inside the context task's body Looking at logging it appears as though the child thinks it has the tty but no input is accepted on the REPL and a further `ctrl-c` results in some teardown but also a further hang where both parent and child become unresponsive.. --- examples/debugging/subactor_bp_in_ctx.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/examples/debugging/subactor_bp_in_ctx.py b/examples/debugging/subactor_bp_in_ctx.py index 827bd85..047338d 100644 --- a/examples/debugging/subactor_bp_in_ctx.py +++ b/examples/debugging/subactor_bp_in_ctx.py @@ -2,27 +2,46 @@ import tractor import trio +async def gen(): + yield 'yo' + await tractor.breakpoint() + yield 'yo' + + @tractor.context async def just_bp( ctx: tractor.Context, ) -> None: - await tractor.breakpoint() await ctx.started('yo bpin here') + await tractor.breakpoint() + + # async for val in gen(): + # print(val) + + await trio.sleep(0.5) + + # THIS CAUSES AN UNRECOVERABLE HANG!? + assert 0 + async def main(): async with tractor.open_nursery( + loglevel='transport', debug_mode=True, ) as n: p = await n.start_actor( 'bp_boi', enable_modules=[__name__], + # debug_mode=True, ) async with p.open_context( just_bp, ) as (ctx, first): + # await tractor.breakpoint() + # breakpoint() await trio.sleep_forever()