[Twisted-Python] [PATCH] UDP error trapping on Cygwin

Jean-Paul Calderone exarkun at divmod.com
Wed Feb 7 07:57:21 MST 2007


On Tue, 6 Feb 2007 23:27:23 -0500, Paul Marks <pmarks at purdue.edu> wrote:
>I wrote this program that uses Twisted with a bunch of UDP
>communication, and a friend of mine got this exception while running
>it on Cygwin:
>
>Traceback (most recent call last):
>  File "/usr/lib/python2.4/site-packages/twisted/python/log.py", line
>48, in callWithLogger
>    return callWithContext({"system": lp}, func, *args, **kw)
>  File "/usr/lib/python2.4/site-packages/twisted/python/log.py", line
>33, in callWithContext
>    return context.call({ILogContext: newCtx}, func, *args, **kw)
>  File "/usr/lib/python2.4/site-packages/twisted/python/context.py",
>line 59, in callWithContext
>    return self.currentContext().callWithContext(ctx, func, *args, **kw)
>  File "/usr/lib/python2.4/site-packages/twisted/python/context.py",
>line 37, in callWithContext
>    return func(*args,**kw)
>--- <exception caught here> ---
>  File "/usr/lib/python2.4/site-packages/twisted/internet/selectreactor.py",
>line 139, in _doReadOrWrite
>    why = getattr(selectable, method)()
>  File "/usr/lib/python2.4/site-packages/twisted/internet/udp.py",
>line 114, in doRead
>    data, addr = self.socket.recvfrom(self.maxPacketSize)
>socket.error: (104, 'Connection reset by peer')
>
>
>My interpretation is that windows (and therefore Cygwin) can throw a
>Connection Reset By Peer error when receiving UDP packets, and Twisted
>only checks for the error on win32, but not on Cygwin, because Cygwin
>is identified as posix.
>
>Anyway, here's a patch I wrote that fixes the problem by checking for
>ECONNRESET on every platform, although I'm not sure if that is the
>correct approach.
>

Thanks for the patch.  I'm not sure if it's correct either. ;)  Cygwin
isn't an officially supported platform for Twisted at the moment.  What
this basically means is that we don't do regular testing on Cygwin, so
this may not be the only problem you encounter.  Moreover, even if we
fix this, it's pretty unlikely anyone would notice if a subsequent change
breaks it again.

This is a pretty straightforward situation to remedy, though.  Someone
just needs to volunteer to run a Cygwin buildslave.  As long as there is
a buildslave for a platform, it'll get regular testing and changes which
break functionality (as reported by the test suite - by the way, is there
an existing failing unit test for this defect?) won't be allowed.

Jean-Paul




More information about the Twisted-Python mailing list