On Apr 20, 2016, at 1:31 PM, Jonathan Vanasco wrote:
> A specific library was keeping the port open. I'm tracking down how/why
> right now.
So this was fun <sarcasm> thing to learn...
An undocumented (yay) feature of python appears to be... python binds to a
random port on all interfaces (0.0.0.0) once you send UDP data through it. I
assume this is to allow for a response to come back.
We're using statsd for metrics in our twisted daemon and detect issues
post-deployment.
If you haven't used it, it's a node.js daemon from etsy that collects udp data
and pipes it into python's graphite/carbon libraries. Then you get fancy
graphics.
# this does nothing...
sock = socket.socket(family, socket.SOCK_DGRAM)
# but this binds to 0.0.0.0
sock.sendto(data.encode('ascii'), addr)
Sending data to the stats collector on 127.0.0.1:8125 inherently made python
bind to 0.0.0.0, and on a port that seems to be in the 40000-60000 range.
Since a socket to the stats collector is only created once for the process,
Python holds that open the entire time.
_______________________________________________
Twisted-Python mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python