[Twisted-Python] mystery exception
![](https://secure.gravatar.com/avatar/87c5d0a7b707c5bfc04b415e96edef11.jpg?s=120&d=mm&r=g)
I am writing network proxy, based on proxy.py code. I am also using getPage() and deffered. From time to time I am getting this mystery exception, the source of which I could not track. Does anybody knows what could be causing it? I am pretty sure I am not closing any sokets twice in my code. The code writing 'x' seems weird to me. Traceback (most recent call last): File "/usr/lib64/python2.5/threading.py", line 460, in __bootstrap self.run() File "/usr/lib64/python2.5/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) --- <exception caught here> --- File "/usr/lib/python2.5/site-packages/twisted/python/threadpool.py", line 161, in _worker context.call(ctx, function, *args, **kwargs) File "/usr/lib/python2.5/site-packages/twisted/python/context.py", li ne 59, in callWithContext return self.currentContext().callWithContext(ctx, func, *args, **kw ) File "/usr/lib/python2.5/site-packages/twisted/python/context.py", li ne 37, in callWithContext return func(*args,**kw) File "/usr/lib/python2.5/site-packages/twisted/internet/threads.py", line 29, in _putResultInDeferred reactor.callFromThread(deferred.callback, result) File "/usr/lib/python2.5/site-packages/twisted/internet/base.py", line 824, in callFromThread self.wakeUp() File "/usr/lib/python2.5/site-packages/twisted/internet/base.py", line 443, in wakeUp self.waker.wakeUp() File "/usr/lib/python2.5/site-packages/twisted/internet/posixbase.py", line 138, in wakeUp util.untilConcludes(os.write, self.o, 'x') File "/usr/lib/python2.5/site-packages/twisted/python/util.py", line 757, in untilConcludes return f(*a, **kw) exceptions.OSError: [Errno 32] Broken pipe My OS is: Linux xxxx 2.6.23.1-42.fc8 #1 SMP Tue Oct 30 13:18:33 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux and I am using latest version of Twisted. Sincerely, Vadim
![](https://secure.gravatar.com/avatar/7ed9784cbb1ba1ef75454034b3a8e6a1.jpg?s=120&d=mm&r=g)
On Tue, 14 Oct 2008 18:14:47 -0700, Vadim Zaliva <krokodil@gmail.com> wrote:
I am writing network proxy, based on proxy.py code. I am also using getPage() and deffered. From time to time I am getting this mystery exception, the source of which I could not track. Does anybody knows what could be causing it? I am pretty sure I am not closing any sokets twice in my code. The code writing 'x' seems weird to me.
Something in your program broke the reactor. Or you found a bug in the reactor which causes it to break itself. It doesn't seem likely anyone will be able to figure out which or how without seeing your actually source, though. If you can provide a minimal example of this, and it's a bug in Twisted, we should be able to fix it. This is a pretty central piece of functionality, though, and it gets exercised all the time, so chances are good that there's something in your program that's causing it. The specific problem is that a pipe file descriptor, internal to the reactor, has been closed. The reactor is not expecting this to happen, and it shouldn't, since it never closes it. Jean-Paul
![](https://secure.gravatar.com/avatar/87c5d0a7b707c5bfc04b415e96edef11.jpg?s=120&d=mm&r=g)
On Oct 14, 2008, at 19:15, Jean-Paul Calderone wrote:
The specific problem is that a pipe file descriptor, internal to the reactor, has been closed. The reactor is not expecting this to happen, and it shouldn't, since it never closes it.
Could it be related to permissions? I am demonizing my program standard way, closing all open descriptors, chdir(/), etc. Where the FIFO is created normally? Sincerely, Vadim
![](https://secure.gravatar.com/avatar/87c5d0a7b707c5bfc04b415e96edef11.jpg?s=120&d=mm&r=g)
On Oct 14, 2008, at 20:31, Vadim Zaliva wrote:
The specific problem is that a pipe file descriptor, internal to the reactor, has been closed. The reactor is not expecting this to happen, and it shouldn't, since it never closes it.
Could it be related to permissions? I am demonizing my program standard way, closing all open descriptors, chdir(/), etc. Where the FIFO is created normally?
This is the daemonisation code I am using: http://pastebin.com/mf54c5cd It seems that it is causing the problem. Vadim
![](https://secure.gravatar.com/avatar/d6328babd9f9a98ecc905e1ccac2495e.jpg?s=120&d=mm&r=g)
On 03:40 am, krokodil@gmail.com wrote:
On Oct 14, 2008, at 20:31, Vadim Zaliva wrote:
The specific problem is that a pipe file descriptor, internal to the reactor, has been closed. The reactor is not expecting this to happen, and it shouldn't, since it never closes it.
Could it be related to permissions? I am demonizing my program standard way, closing all open descriptors, chdir(/), etc. Where the FIFO is created normally?
This is the daemonisation code I am using:
It seems that it is causing the problem.
The "twistd" tool included with Twisted has many features, including daemonization. You shouldn't need to use something like this to get a twisted daemon running.
participants (3)
-
glyph@divmod.com
-
Jean-Paul Calderone
-
Vadim Zaliva