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..sigint_ignore_in_pdb_repl
							parent
							
								
									5322a6604e
								
							
						
					
					
						commit
						ed9c359a1d
					
				|  | @ -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() | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue