[Twisted-Python] Non returning deferred result.

Andrew Bennetts andrew-twisted at puzzling.org
Fri Apr 18 00:53:24 MDT 2008


Crispin Wellington wrote:
[...]
> This DOES work except for a little strange behavoir. When the deferred
> callback is triggered, the client doesn't see any response, the
> connection just stays open. Then if I connect to the webservices from
> anywhere, even a bad URL, I get my response suddenly back.
> 
> It's as if the callback is not triggered until some TCP activity cause
> the main reactor to pump the pending requests or something. Is there

I'm betting you are doing "deferred.callback(...)" from the thread.  Twisted's
APIs are in general *not* thread-safe.  You should do
"reactor.callFromThread(deferred.callback, ...)" instead.  I suspect that will
fix your problem.

-Andrew.





More information about the Twisted-Python mailing list