Barney Stratford <barney_stratf...@fastmail.fm> added the comment:

Sure. So, I'm using STOMP to connect to a messaging server. STOMP uses 
heartbeats to detect and close failed connections. The problem was that if the 
connection fails before the protocol has set up its heartbeats then there's 
nothing to stop the whole thing hanging. I had a timeout on the 
socket.create_connection, thinking this would protect against this edge-case, 
but it wasn't sufficient.

STOMP is such a simple protocol that it's often worth writing your own code to 
handle it. Indeed, this is actively encouraged. My own STOMP code is about 250 
lines in a single source file, compared to nearly 3500 lines in 13 files for 
stomp.py. I very much prefer to simplify things as much as possible, and 
smaller is almost always better in my view. Simplify!

So, I kept seeing this very occasional hang-up in my code, and probing it with 
gdb showed that the execution was always stuck inside the poll. Of course it 
was, as that's where it sits to wait for something to happen. Then I was lead 
astray by finding that website, so I saddled up to save the world, as one does 
in such situations.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42513>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to