[Twisted-Python] A non-blocking socket operation could not be completed immediately

Tommaso Mazzafico tommaso.mazzafico at yahoo.com
Wed Nov 18 11:53:03 MST 2009


--- On Wed, 11/18/09, Itamar Turner-Trauring (aka Shtull-Trauring) <itamar at itamarst.org> wrote:

> On Wed, 2009-11-18 at 06:03 -0800,
> Tommaso Mazzafico wrote:
> > I tried this code:
> > 
> > -----------------------------------------
> > from twisted.spread import pb
> > from twisted.internet import reactor
> > 
> > class Echoer(pb.Root):
> >    def remote_echo(self, s):
> >       return s
> > if __name__ == "__main__":
> >    reactor.listenTCP(8001,
> pb.PBServerFactory(Echoer()))
> >    reactor.run()
> > -----------------------------------------
> > 
> > On Windows XP all is ok.
> > On Windows 7 64 I receive this error message:
> > 
> > -----------------------------------------
> > C:\Program Files
> (x86)\Python\lib\site-packages\twisted\spread\pb.py:30:
> DeprecationWarning: the md5 module is deprecated; use
> hashlib instead
> >   import md5
> > Traceback (most recent call last):
> >   File
> "C:\Users\bob\Documents\Twisted\pbs.py", line 11, in
> <module>
> >     reactor.listenTCP(8001,
> pb.PBServerFactory(Echoer()))
> >   File "C:\Program Files
> (x86)\Python\lib\site-packages\twisted\internet\posixbase.py",
> line 356, in listenTCP
> >     p.startListening()
> >   File "C:\Program Files
> (x86)\Python\lib\site-packages\twisted\internet\tcp.py",
> line 862, in startListening
> >     self._realPortNumber =
> skt.getsockname()[1]
> >   File "<string>", line 1, in
> getsockname
> > socket.error: [Errno 10035] A non-blocking socket
> operation could not be completed immediately
> > -----------------------------------------
> > 
> > What can I do?
> 
> 1. Please file a bug at http://twistedmatrix.com/ - include
> version of
> Twisted, whether you have firewall of some sort, etc., so
> we can make
> sure this gets fixed.
> 
> 2. Try patching the code so it does:
>     
>     from twisted.internet.util import
> untilConcludes
>     self._realPortNumber = untilConcludes(lambda:
> skt.getsockname()[1])
> 
> Does this fix it? If it does, add this info to the bug.

I tried patching like that:

from twisted.python.util import untilConcludes # I think you mean this, because twisted.internet.util does not exist
self._realPortNumber = untilConcludes(lambda: skt.getsockname()[1])

but without luck. It seems to change nothing, it crashes at once with the same stack trace. I'm on Windows 7 64, Python 2.6.4, Twisted 8.2.0

I'm quite new to Python and very new to Twisted. I will look for "IOCP reactor"
I'm going to file a bug on Trac, thank you for the help.


      




More information about the Twisted-Python mailing list