[Twisted-Python] problems with threadedselectreactor

Antony Kummel antonykummel at yahoo.com
Tue Nov 29 07:15:08 EST 2005

  I encountered two problems when using threadedselectreactor on win32. I  am not versed enough with reactor technicalities to resolve them  myself, but I would gladly conduct any tests the experts recommend.
  1. I often get tracebacks similar to this:
        File  "C:\Python23\Lib\site-packages\twisted\internet\threadedselectreactor.py",  line 299, in _doReadOrWrite
          why = getattr(selectable, method)()
        File "C:\Python23\Lib\site-packages\twisted\internet\abstract.py", line 108, in doWrite
          l = self.writeSomeData(self.dataBuffer)
        File "C:\Python23\lib\site-packages\twisted\internet\tcp.py", line 358, in writeSomeData
          return self.socket.send(buffer(data, 0, self.SEND_LIMIT))
      exceptions.AttributeError: 'Server' object has no attribute 'socket'
  To my understanding, this can only happen if the Server's  connectionLost method had been called before the exception happened,  but for some reason, writeSomeData (or sometimes another method) was  still called. I hypothesize that the Server should have been removed  from some list or another but wasn't, and that this is the reactor's  responsibility.
  2. Sometimes I get this error:
  Traceback (most recent call last):
    File "C:\Python23\Lib\site-packages\wx-2.6-msw-unicode\wx\_core.py", line 7493, in MainLoop
    File "C:\Python23\Lib\site-packages\wx-2.6-msw-unicode\wx\_core.py", line 6926, in MainLoop
      return _core_.PyApp_MainLoop(*args, **kwargs)
    File "C:\Python23\Lib\site-packages\wx-2.6-msw-unicode\wx\_core.py", line 13266, in <lambda>
      lambda event: event.callable(*event.args, **event.kw) )
    File "C:\Python23\Lib\site-packages\twisted\internet\threadedselectreactor.py", line 241, in _interleave
  --- <exception caught here> ---
    File "C:\Python23\Lib\site-packages\twisted\internet\base.py", line 541, in runUntilCurrent
      call.func(*call.args, **call.kw)
    File "C:\Python23\Lib\site-packages\twisted\internet\task.py", line 91, in __call__
    File "C:\Python23\Lib\site-packages\twisted\internet\task.py", line 108, in _reschedule
      self.call = reactor.callLater(delay, self)
    File "C:\Python23\Lib\site-packages\twisted\internet\threadedselectreactor.py", line 116, in callLater
    File "C:\Python23\Lib\site-packages\twisted\internet\threadedselectreactor.py", line 112, in wakeUp
    File "C:\Python23\Lib\site-packages\twisted\internet\posixbase.py", line 85, in wakeUp
  socket.error: (10055, 'No buffer space available')
  This doesn't seem to be a threadedselectreactor problem, but rather a  problem that stems from it's use with arbitrary event loops. I suspect  that it happens when the main thread doesn't respond for some time. I  think that the best way to deal with it is simply to ignore this error  (in wakeUp), because if the buffer is full, then the main thread  already knows (or about to find out) that it needs to wake up, although  maybe the user should be somehow notified that there is a problem (log  message?).
  Antony Kummel

 Yahoo! Personals
 Single? There's someone we'd like you to meet.
 Lots of someones, actually. Yahoo! Personals
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20051129/96310b5b/attachment.htm 

More information about the Twisted-Python mailing list