[Twisted-Python] multiple workers

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Thu Sep 2 08:01:41 EDT 2010

On 1 Sep, 10:53 pm, ruslan.usifov at gmail.com wrote:
>I try to write twisted based daemon that work in multiple workers, like
>from twisted.internet import reactor;
>from proxy import FASTCGIServerProxyFactory;
>import os;
>for i in xrange(3):
>  l_pid = os.fork();
>  if(l_pid == 0):
>    break;
>I creatae 4 wokers(by num of CPU cores). Im my test all ok, but when i
>shutdown daemon i got follow error 3 times (because every worker try to
>unlink sock file: /tmp/twisted-fcgi.sock):

Using fork this way isn't supported.  Either fork before you import any 
Twisted modules, or use reactor.spawnProcess to create workers instead. 
If you must share a single listening socket amongst all the workers, you 
might be interested in <http://twistedmatrix.com/trac/ticket/4387>.


More information about the Twisted-Python mailing list