[Twisted-Python] Strange twistd behaviour

Andrew Bennetts andrew-twisted at puzzling.org
Mon Mar 12 09:16:56 MDT 2007


Jarek Zgoda wrote:
> I have an application ran as a twistd plugin. It spawns a "worker 
> thread" that gets objects from Queue.Queue and runs in a "while 1: " 
> loop. The problem I got is that when I run the application without 
> daemonizing it (using -n switch for twistd) everything works fine, but 
> as soon as it is run as daemon, the thread does not perform the 
> "looping". I am bit stuck, as I don't know even where to look for 
> possible causes... Can anybody put some light here?

You probably spawn the thread in the wrong process.

You should make sure the thread is spawned by the reactor, e.g. by doing it
from a startService method or using reactor.callWhenRunning.

-Andrew.





More information about the Twisted-Python mailing list