Hi<br>
<br>
I have an application which uses web2. In good twisted style I'm writing tests for it, and using trial.<br>
<br>
When performing some rather simple page retrievals a get a lingering http channel. Setting<br>
twisted.internet.base.DelayedCall.debug = True<br>
I get this trace:<br>
<br>
<br>
&nbsp; File &quot;/usr/lib/python2.4/site-packages/twisted/trial/util.py&quot;, line 131, in _dispatch<br>
&nbsp;&nbsp;&nbsp; getattr(self, &quot;do_%s&quot; % attr)()<br>
&nbsp; File &quot;/usr/lib/python2.4/site-packages/twisted/trial/util.py&quot;, line 173, in do_cleanPending<br>
&nbsp;&nbsp;&nbsp; raise PendingTimedCallsError(s)<br>
twisted.trial.util.PendingTimedCallsError: pendingTimedCalls still
pending (consider setting twisted.internet.base.DelayedCall.debug =
True): &lt;DelayedCall 1083946540 [19.9427890778s] called=0 cancelled=0
HTTPChannel._lingerClose()<br>
<br>
traceback at creation:<br>
<br>
&nbsp; File &quot;/usr/bin/trial&quot;, line 24, in ?<br>
&nbsp;&nbsp;&nbsp; run()<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; File &quot;/usr/lib/python2.4/site-packages/twisted/scripts/trial.py&quot;, line 676, in run<br>
&nbsp;&nbsp;&nbsp; suite = reallyRun(config)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; File &quot;/usr/lib/python2.4/site-packages/twisted/scripts/trial.py&quot;, line 657, in reallyRun<br>
&nbsp;&nbsp;&nbsp; suite.run(config['random'])<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; File &quot;/usr/lib/python2.4/site-packages/twisted/trial/runner.py&quot;, line 250, in run<br>
&nbsp;&nbsp;&nbsp; tr.runTests(randomize=(seed is not None))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; File &quot;/usr/lib/python2.4/site-packages/twisted/trial/runner.py&quot;, line 496, in runTests<br>
&nbsp;&nbsp;&nbsp; runner.runTests(randomize)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; File &quot;/usr/lib/python2.4/site-packages/twisted/trial/runner.py&quot;, line 601, in runTests<br>
&nbsp;&nbsp;&nbsp; self._apply(_runTestMethod)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; File &quot;/usr/lib/python2.4/site-packages/twisted/trial/runner.py&quot;, line 543, in _apply<br>
&nbsp;&nbsp;&nbsp; f(tm)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; File &quot;/usr/lib/python2.4/site-packages/twisted/trial/runner.py&quot;, line 597, in _runTestMethod<br>
&nbsp;&nbsp;&nbsp; testMethod.run(tci)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; File &quot;/usr/lib/python2.4/site-packages/twisted/trial/runner.py&quot;, line 849, in run<br>
&nbsp;&nbsp;&nbsp; orig(tci)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; File &quot;/usr/lib/python2.4/site-packages/twisted/trial/runner.py&quot;, line 332, in __call__<br>
&nbsp;&nbsp;&nbsp; lambda :util.wait(defer.maybeDeferred(self.original, *a, **kw),<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; File
&quot;/usr/lib/python2.4/site-packages/twisted/trial/runner.py&quot;, line 409,
in _runWithWarningFilters<br>
&nbsp;&nbsp;&nbsp; return f(*a, **kw)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; File &quot;/usr/lib/python2.4/site-packages/twisted/trial/runner.py&quot;, line 333, in &lt;lambda&gt;<br>
&nbsp;&nbsp;&nbsp; timeout, useWaitError=True))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; File &quot;/usr/lib/python2.4/site-packages/twisted/trial/util.py&quot;, line 325, in wait<br>
&nbsp;&nbsp;&nbsp; r = _Wait.wait(d, timeout)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; File &quot;/usr/lib/python2.4/site-packages/twisted/trial/util.py&quot;, line 269, in wait<br>
&nbsp;&nbsp;&nbsp; reactor.iterate(0.01)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; File &quot;/usr/lib/python2.4/site-packages/twisted/internet/base.py&quot;, line 360, in iterate<br>
&nbsp;&nbsp;&nbsp; self.doIteration(delay)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; File &quot;/usr/lib/python2.4/site-packages/twisted/internet/selectreactor.py&quot;, line 133, in doSelect<br>
&nbsp;&nbsp;&nbsp; _logrun(selectable, _drdw, selectable, method, dict)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; File &quot;/usr/lib/python2.4/site-packages/twisted/python/log.py&quot;, line 56, in callWithLogger<br>
&nbsp;&nbsp;&nbsp; return callWithContext({&quot;system&quot;: lp}, func, *args, **kw)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; File &quot;/usr/lib/python2.4/site-packages/twisted/python/log.py&quot;, line 41, in callWithContext<br>
&nbsp;&nbsp;&nbsp; return context.call({ILogContext: newCtx}, func, *args, **kw)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; File &quot;/usr/lib/python2.4/site-packages/twisted/python/context.py&quot;, line 52, in callWithContext<br>
&nbsp;&nbsp;&nbsp; return self.currentContext().callWithContext(ctx, func, *args, **kw)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; File &quot;/usr/lib/python2.4/site-packages/twisted/python/context.py&quot;, line 31, in callWithContext<br>
&nbsp;&nbsp;&nbsp; return func(*args,**kw)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; File
&quot;/usr/lib/python2.4/site-packages/twisted/internet/selectreactor.py&quot;,
line 139, in _doReadOrWrite<br>
&nbsp;&nbsp;&nbsp; why = getattr(selectable, method)()<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; File &quot;/usr/lib/python2.4/site-packages/twisted/internet/abstract.py&quot;, line 134, in doWrite<br>
&nbsp;&nbsp;&nbsp; result = self._closeWriteConnection()<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; File
&quot;/usr/lib/python2.4/site-packages/twisted/internet/tcp.py&quot;, line 376,
in _closeWriteConnection<br>
&nbsp;&nbsp;&nbsp; p.writeConnectionLost()<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; File
&quot;/usr/lib/python2.4/site-packages/twisted/web2/channel/http.py&quot;, line
788, in writeConnectionLost<br>
&nbsp;&nbsp;&nbsp; self._lingerTimer = reactor.callLater(20, self._lingerClose)<br>
&gt;<br>
<br>
This if course makes sense, especially if the server lost its
connection. I am doing cleanup in tearDown (calling stopListening() on
the port), but trial still complains. Canceling the call, and calling
it manually in tearDown, doesn't appear to help either. How do I make
it shut it up in a proper way?<br>
<br>
<br>
PS. I'm rather pleased with the web2 framework, especially the stream
framework (once I got my head wrapped around it), but it is hard to get
an overview of the internals. A brief description of the design,
philosophy, what was wrong with web(1), etc. would be very nice (I do
realize that web2 is a moving target).<br>
<br>-- <br>&nbsp;&nbsp; - Henrik