[Twisted-Python] listenTCP & listenSSL failing silently?

Matthew Pounsett matt at conundrum.com
Thu Feb 27 12:33:06 MST 2014


On Feb 27, 2014, at 07:31 , Glyph <glyph at twistedmatrix.com> wrote:

> On Feb 26, 2014, at 7:41 PM, Matthew Pounsett <matt at conundrum.com> wrote:
> 
>> In the above code block
> 
> Before I start speculating as to what might be wrong, can you please attach an SSCCE <http://www.sscce.org/> that fully demonstrates the problem?  listenTCP and listenSSL definitely work on my computer ;-)

Normally I would.. the problem is that I’m having difficulty doing that.  As I said, this is something that normally works for me .. but something is interfering with it, and I can’t figure out what it might be.  I suspect once I’m able to produce a simple example that reproduces the error, I will know exactly what the problem is.

One thing I just realized I’d been overlooking is a traceback when I ^c out of my code (I haven’t yet added any handlers to shut down the reactor).  The difference between my attempt at an SSCCE and the actual code is that the actual code raises an exception *after* the ^c.  I had been assuming that had something to do with the fact that I was breaking out of the code without cleanly shutting things down, but my SSCCE doesn’t exhibit this behaviour.  Unfortunately the traceback doesn’t provide any info that helps me.

Traceback (most recent call last):
  File “./app", line 239, in <module>
    core.main_loop(config)
  File "./modules/core.py", line 73, in main_loop
    reactor.run()
  File "/usr/local/lib/python2.7/site-packages/twisted/internet/base.py", line 1192, in run
    self.mainLoop()
--- <exception caught here> ---
  File "/usr/local/lib/python2.7/site-packages/twisted/internet/base.py", line 1204, in mainLoop
    self.doIteration(t)
  File "/usr/local/lib/python2.7/site-packages/twisted/internet/pollreactor.py", line 155, in doPoll
    l = self._poller.poll(timeout)
  File "/usr/local/lib/python2.7/site-packages/twisted/internet/base.py", line 603, in sigInt
    self.callFromThread(self.stop)
  File "/usr/local/lib/python2.7/site-packages/twisted/internet/base.py", line 948, in callFromThread
    self.wakeUp()
  File "/usr/local/lib/python2.7/site-packages/twisted/internet/base.py", line 519, in wakeUp
    self.waker.wakeUp()
  File "/usr/local/lib/python2.7/site-packages/twisted/internet/posixbase.py", line 181, in wakeUp
    util.untilConcludes(os.write, self.o, b'x')
  File "/usr/local/lib/python2.7/site-packages/twisted/python/util.py", line 832, in untilConcludes
    return f(*a, **kw)
exceptions.OSError: [Errno 57] Socket is not connected


I’ll keep poking at it .. maybe something will jump out at me eventually.





More information about the Twisted-Python mailing list