[Twisted-Python] Hanging test cases (Was: Evangelism notes...)

Grant Baillie grant at osafoundation.org
Thu May 5 14:49:20 EDT 2005


On May 4, 2005, at 1:08 PM, Mike C. Fletcher wrote:

>     * Project was delivered, paid for, and has been running in
>       production for a few weeks, but 2 reported bugs cropped up
>           o To fix one, needed to update to 2.0 (deferred object
>             cleanup)... this caused rather a lot of upset, as the
>             sysadmins were upset about such a huge package needing  
> to be
>             updated (and they tried to do just the core packages  
> first,
>             which doubled the work-load involved in preparing that
>             update versus using Sumo)
>           o Fixing the other was no big deal, except that something in
>             2.0 changed how the test-suite was running so that it now
>             hung on completion...

Did you ever figure out why? I have just run into similar behaviour  
myself after upgrading to 2.0. Here's an example that hangs for me on  
Mac OS X (10.4) after the final print:

---------------
from twisted.internet import reactor, defer, threads
from twisted.trial.util import deferredResult
from twisted.web.client import getPage
import time


def itFired(result):
     print "Deferred fired: %s" % result
     return result

d = getPage("http://www.example.com/").addBoth(itFired)

print "Returned: %s" % deferredResult(d)
print "Done; exiting"
---------------


So far as I can tell, the python threading module has an atexit  
handler that's hanging. Also, if I replace the deferToThread() with a  
twisted.web.client.getPage(), I still get the same hang.

--Grant

Grant Baillie
Open Source Applications Foundation





More information about the Twisted-Python mailing list