Opened 10 years ago

Closed 5 years ago

#2447 defect closed invalid (invalid)

server.Site leaves the reactor unclean

Reported by: ghazel Owned by: Jean-Paul Calderone
Priority: normal Milestone:
Component: web Keywords:
Cc: jesstess Branch:
Author:

Description

This is a simple test that leaves the reactor unclean. It's not clear how to clean up the reactor before this test ends.

Here's the output:

Running 1 tests.
test_cl.TestCL.testCL ... 
C:\Python24\lib\site-packages\twisted\trial\reporter.py:142: twisted.trial.reporter.BrokenTestCaseWarning: REACTOR UNCLEAN! traceback(s) follow: 
  File "C:\Python24\lib\site-packages\twisted\trial\util.py", line 72, in _dispatch
    getattr(self, "do_%s" % attr)()
  File "C:\Python24\lib\site-packages\twisted\trial\util.py", line 99, in do_cleanPending
    raise PendingTimedCallsError(s)
twisted.trial.util.PendingTimedCallsError: pendingTimedCalls still pending (consider setting twisted.internet.base.DelayedCall.debug = True): <DelayedCall 16035192 [43200.0s] called=0 cancelled=0 HTTPChannel.__timedOut()>




C:\Python24\lib\site-packages\twisted\trial\reporter.py:142: twisted.trial.reporter.BrokenTestCaseWarning: REACTOR UNCLEAN! traceback(s) follow: 
  File "C:\Python24\lib\site-packages\twisted\trial\util.py", line 72, in _dispatch
    getattr(self, "do_%s" % attr)()
  File "C:\Python24\lib\site-packages\twisted\trial\util.py", line 129, in do_cleanReactor
    raise DirtyReactorError(' '.join(s))
twisted.trial.util.DirtyReactorError: THIS WILL BECOME AN ERROR SOON! reactor left in unclean state, the following Selectables were left over:  <HTTPChannel #0 on 19999>


-------------------------------------------------------------------------------
Ran 1 tests in 0.016s

PASSED

There are supposed to be newlines in there. Man I hate wikis.

Attachments (1)

test_cl.py (907 bytes) - added by ghazel 10 years ago.
testcase that leaves the reactor unclean.

Download all attachments as: .zip

Change History (8)

Changed 10 years ago by ghazel

Attachment: test_cl.py added

testcase that leaves the reactor unclean.

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

Resolution: duplicate
Status: newclosed

I think this is a duplicate of #2386

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

Resolution: duplicate
Status: closedreopened

No, I was mistaken. #2386 is about the _resetLogDateTime DelayedCall. This ticket is about the HTTPChannel.timedOut DelayedCall.

comment:3 Changed 6 years ago by <automation>

Owner: jknight deleted

comment:4 Changed 5 years ago by jesstess

Cc: jesstess added
Owner: set to ghazel
Status: reopenednew

Thanks for reporting this, ghazel. Your test runs without a dirty reactor warning or error with Twisted 11.0 for me. Can you check if this is still an issue for you?

comment:5 Changed 5 years ago by ghazel

Owner: changed from ghazel to Jean-Paul Calderone

Unsure since it's been too long. Exarkun seemed to have some idea.

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

I think this should be closed. The delayed call that is pending is the idle timeout for the server connection, set up by TimeoutMixin.setTimeout and pending cleanup by HTTPChannel.connectionLost. The test stops the server factory and shuts down the listening port (which would have stopped the server factory on its own - though it fails to return the Deferred from stopListening so trial might continue before the port is really cleaned up). It waits for the client side of the connection to close, but it doesn't wait for the server side to close. So it's possible that the test completes while the server side of the connection is still up. I think that just makes it a test bug (albeit it an annoying one to have to work around).

comment:7 Changed 5 years ago by jesstess

Resolution: invalid
Status: newclosed

Thanks for checking in, ghazel and exarkun. I'll go ahead and close.

Note: See TracTickets for help on using tickets.