[Twisted-Python] debugging listenTCP
exarkun at twistedmatrix.com
exarkun at twistedmatrix.com
Sun Mar 24 11:45:42 EDT 2013
On 12 Mar, 01:40 am, matt at conundrum.com wrote:
>
>I've got a weird one here. I've just come back to some code that I
>haven't worked on in a while, which is a simple XMLRPC server. Last
>time I touched it I was working on adding cred support, so I'd gone
>from using a direct call to server.Site() in my listenTCP call to using
>my own factory/portal/etc.
>
>When I fired it up this time, listenTCP was failing to bind to the
>requested ports, but not raising an exception. I started writing up an
>email to ask about debugging this, but while doing information
>collection it started working again. Then not. Now it's working
>again. It looks like I've got some sort of intermittent failure, but I
>have no idea how to track it down.
Hi Matthew,
I wonder if you learned anything more about what was going on this case
or if it's still causing problems for you.
Jean-Paul
> # 'interfaces' is just a simple list of IP addresses. The map()
> # call provides formatting for the log message
> logger.debug("Connecting to port {} on interfaces: {}".format(
> port, ", ".join(map( lambda x: "'{}'".format(x), interfaces))))
> for iface in interfaces:
> reactor.listenTCP(port, factory, interface=iface)
> reactor.run()
>
>The application should bind to [::1]:8602 and 127.0.0.1:8602, and
>logging seems to indicate this is what it's trying to do.
>
>01:28:31 [server ] Connecting to port 8602 on interfaces: '::1',
>'127.0.0.1'
>
>However, intermittently lsof and netstat are showing no binding.
>>netstat -an | grep -c 8602
>0
>
>I tried turning on twisted's internal logging, but that is giving me
>nothing useful. I see no way to turn up the debugging level on this
>log, but I normally use python's standard logger and perhaps I've
>missed some piece of documentation. This is a sample from when it was
>failing:
>
>2013-03-12 01:28:31+0000 [-] Log opened.
>2013-03-12 01:28:31+0000 [-] ServerFactory starting on 8602
>2013-03-12 01:28:31+0000 [-] Starting factory
><insurrection.server.ServerFactory instance at 0x85a81488>
>2013-03-12 01:28:31+0000 [-] ServerFactory starting on 8602
>
>Can anyone suggest anything more I can do to track down the problem
>next time it crops up?
>
>
>
>_______________________________________________
>Twisted-Python mailing list
>Twisted-Python at twistedmatrix.com
>http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
More information about the Twisted-Python
mailing list