forked from goodboy/tractor
1
0
Fork 0

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..
sigint2
Tyler Goodlet 2022-02-07 07:02:39 -05:00
parent eb017c8da6
commit 85aa8899b3
1 changed files with 20 additions and 1 deletions

View File

@ -2,27 +2,46 @@ import tractor
import trio import trio
async def gen():
yield 'yo'
await tractor.breakpoint()
yield 'yo'
@tractor.context @tractor.context
async def just_bp( async def just_bp(
ctx: tractor.Context, ctx: tractor.Context,
) -> None: ) -> None:
await tractor.breakpoint()
await ctx.started('yo bpin here') 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 def main():
async with tractor.open_nursery( async with tractor.open_nursery(
loglevel='transport',
debug_mode=True, debug_mode=True,
) as n: ) as n:
p = await n.start_actor( p = await n.start_actor(
'bp_boi', 'bp_boi',
enable_modules=[__name__], enable_modules=[__name__],
# debug_mode=True,
) )
async with p.open_context( async with p.open_context(
just_bp, just_bp,
) as (ctx, first): ) as (ctx, first):
# await tractor.breakpoint()
# breakpoint()
await trio.sleep_forever() await trio.sleep_forever()