Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#5274 defect closed duplicate (duplicate)

processEnded of ProcessProtocol can be called after reactor.spawnProcess but without reactor running.

Reported by: David Kao Owned by:
Priority: normal Milestone:
Component: core Keywords:
Cc: Jean-Paul Calderone Branch:


[root@master1 play]# cat
from twisted.internet import reactor

from twisted.internet import reactor, protocol

class OneRun(protocol.ProcessProtocol):
   def processEnded(self, reason):
       print "Process ended\n"

reactor.spawnProcess(OneRun(), executable="echo", args=["echo",
"hello"], childFDs={0:0, 1:1, 2:2})
[root@master1 play]# python
Process ended

[root@master1 play]#

--- Thanks for this follow-up. I noticed that in this snippet, there's no `´ call at all. This is a better example, since it shows `processEnded´ being called even though there's no chance of the reactor ever being running. Investigating this, I see that there is an early- exit case in process support (in `twisted/internet/´, line 65) which may call `processEnded´ even when the reactor is not running. Inserting a sleep(1) before the `os.waitpid´ call in that function makes it much more likely to trigger this case, since it gives the child plenty of time to exit.

This strikes me as a bug. Can you file a new ticket for this?

Thanks again, Jean-Paul ---

Change History (2)

comment:1 Changed 7 years ago by David Kao

Resolution: duplicate
Status: newclosed

comment:2 Changed 7 years ago by Jean-Paul Calderone

#5287 was a duplicate of this.

Note: See TracTickets for help on using tickets.