Opened 6 years ago

Closed 6 years ago

#5708 defect closed invalid (invalid)

PollReactor.running returns True and reactor.stop() raises ReactorNotRunning

Reported by: Adi Roiban Owned by: Adi Roiban
Priority: normal Milestone:
Component: core Keywords:
Cc: Branch:



It looks like the reactor.running attributes gets out of sync for restartable reactors.

I have the following state:

(Pdb) reactor
<twisted.internet.pollreactor.PollReactor object at 0x8c0cfac>
(Pdb) reactor.running
(Pdb) reactor.stop()
*** ReactorNotRunning: Can't stop reactor that isn't running.
(Pdb) reactor.running

Change History (2)

comment:1 Changed 6 years ago by Jean-Paul Calderone

Owner: set to Adi Roiban

Reactors aren't restartable. From your example, it's not clear why running is True but stop isn't working, but there are a number of legitimate ways to get into this state.

Please post full reproduction instructions so we can decide if this is a legitimate case or not. :)

As a general suggestion, don't use reactor.running in your programs (not sure if you are doing that or just using it to demonstrate a reactor.stop problem here).

comment:2 Changed 6 years ago by Adi Roiban

Resolution: invalid
Status: newclosed

I am using reactor.running and reactor.stop() only in tests.

I am not using trial, but a custom TestCase for python-nose:

I get this error when using twisted.enterprise and I think it is due to some threads in the reactor. The current code using twisted.enterprise is a bit messy and I can not produce a clean example.

Since there are legitimate ways to get into this state, I will consider this ticket invalid and will reopen it once I can come with a clear example.

Thanks and sorry for the noise!

Note: See TracTickets for help on using tickets.