Hello<br><br>I try to write twisted based daemon that work in multiple workers, like this:<br><br>from twisted.internet import reactor;<br>from proxy import FASTCGIServerProxyFactory;<br>import os;<br><br>reactor.listenUNIX("/tmp/twisted-fcgi.sock", FASTCGIServerProxyFactory());<br>
<br>for i in xrange(3):<br> l_pid = os.fork();<br><br> if(l_pid == 0):<br> break;<br><br>reactor.run()<br><br>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):<br>
<br>Traceback (most recent call last):<br> File "/usr/local/lib/python2.6/site-packages/twisted/internet/defer.py", line 249, in addCallbacks<br> self._runCallbacks()<br> File "/usr/local/lib/python2.6/site-packages/twisted/internet/defer.py", line 441, in _runCallbacks<br>
self.result = callback(self.result, *args, **kw)<br> File "/usr/local/lib/python2.6/site-packages/twisted/internet/base.py", line 426, in _continueFiring<br> callable(*args, **kwargs)<br> File "/usr/local/lib/python2.6/site-packages/twisted/internet/base.py", line 613, in disconnectAll<br>
failure.Failure(main.CONNECTION_LOST))<br>--- <exception caught here> ---<br> File "/usr/local/lib/python2.6/site-packages/twisted/python/log.py", line 84, in callWithLogger<br> return callWithContext({"system": lp}, func, *args, **kw)<br>
File "/usr/local/lib/python2.6/site-packages/twisted/python/log.py", line 69, in callWithContext<br> return context.call({ILogContext: newCtx}, func, *args, **kw)<br> File "/usr/local/lib/python2.6/site-packages/twisted/python/context.py", line 59, in callWithContext<br>
return self.currentContext().callWithContext(ctx, func, *args, **kw)<br> File "/usr/local/lib/python2.6/site-packages/twisted/python/context.py", line 37, in callWithContext<br> return func(*args,**kw)<br>
File "/usr/local/lib/python2.6/site-packages/twisted/internet/unix.py", line 134, in connectionLost<br> os.unlink(self.port)<br>exceptions.OSError: [Errno 2] No such file or directory: '/tmp/twisted-fcgi.sock'<br>
<br>So my questions is How can i suppress this behaviour, so shutdown code executes only once in main process?<br>