Unset debug-mode on root actor exit
Discovered this bug while testing `modden`'s daemon under various cancelled-while-booting race conditions where sequential tests would fail a lingering `assert 0` inside `.to_asyncio.run_as_asyncio_guest()` to (oddly) catch redundant greenback-re-inits.. XD Needs a test likely ;Prepl_fixture
							parent
							
								
									e2f24b189b
								
							
						
					
					
						commit
						69984c44ef
					
				| 
						 | 
					@ -281,7 +281,8 @@ async def open_root_actor(
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (
 | 
					        if (
 | 
				
			||||||
            debug_mode
 | 
					            debug_mode
 | 
				
			||||||
            and _spawn._spawn_method == 'trio'
 | 
					            and
 | 
				
			||||||
 | 
					            _spawn._spawn_method == 'trio'
 | 
				
			||||||
        ):
 | 
					        ):
 | 
				
			||||||
            _state._runtime_vars['_debug_mode'] = True
 | 
					            _state._runtime_vars['_debug_mode'] = True
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -517,8 +518,17 @@ async def open_root_actor(
 | 
				
			||||||
                    )
 | 
					                    )
 | 
				
			||||||
                    await actor.cancel(None)  # self cancel
 | 
					                    await actor.cancel(None)  # self cancel
 | 
				
			||||||
        finally:
 | 
					        finally:
 | 
				
			||||||
 | 
					            # revert all process-global runtime state
 | 
				
			||||||
 | 
					            if (
 | 
				
			||||||
 | 
					                debug_mode
 | 
				
			||||||
 | 
					                and
 | 
				
			||||||
 | 
					                _spawn._spawn_method == 'trio'
 | 
				
			||||||
 | 
					            ):
 | 
				
			||||||
 | 
					                _state._runtime_vars['_debug_mode'] = False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            _state._current_actor = None
 | 
					            _state._current_actor = None
 | 
				
			||||||
            _state._last_actor_terminated = actor
 | 
					            _state._last_actor_terminated = actor
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            logger.runtime(
 | 
					            logger.runtime(
 | 
				
			||||||
                f'Root actor terminated\n'
 | 
					                f'Root actor terminated\n'
 | 
				
			||||||
                f')>\n'
 | 
					                f')>\n'
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue