[Twisted-Python] Non returning deferred result.

Crispin Wellington cwellington at ccg.murdoch.edu.au
Fri Apr 18 01:47:29 MDT 2008


Andrew,

I certainly was calling it from the other thread! And that
callFromThread() certainly did fix my problem! :)

Thanks a heap!

Crispin

On Fri, 2008-04-18 at 16:53 +1000, Andrew Bennetts wrote:
> 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.
> 
> 
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> 





More information about the Twisted-Python mailing list