File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -434,12 +434,21 @@ def test_shutdown_wait_false(self):
434434 l1 = self .router .local ()
435435 pid = l1 .call (os .getpid )
436436
437- conn = self .router .stream_by_id (l1 .context_id ). conn
437+ strm = self .router .stream_by_id (l1 .context_id )
438438 exitted = mitogen .core .Latch ()
439- mitogen .core .listen (conn .proc , 'exit' , exitted .put )
439+
440+ # It is possible for Process 'exit' signal to fire immediately during
441+ # processing of Stream 'disconnect' signal, so we must wait for both,
442+ # otherwise ChannelError below will return 'respondent context has
443+ # disconnected' rather than 'no route', because RouteMonitor hasn't run
444+ # yet and the Receiver caught Context 'disconnect' signal instead of a
445+ # dead message.
446+ mitogen .core .listen (strm .conn .proc , 'exit' , exitted .put )
447+ mitogen .core .listen (strm , 'disconnect' , exitted .put )
440448
441449 l1 .shutdown (wait = False )
442450 exitted .get ()
451+ exitted .get ()
443452
444453 e = self .assertRaises (OSError ,
445454 lambda : os .waitpid (pid , 0 ))
You can’t perform that action at this time.
0 commit comments