[issue13109] telnetlib insensitive to connection loss

Eric V. Smith report at bugs.python.org
Thu Oct 6 16:29:10 CEST 2011


Eric V. Smith <eric at trueblade.com> added the comment:

Assuming that you're unplugging the cable when the code is in the loop that occurs after the line "self.pcPart.write(cmdx)", and also assuming that you haven't turned on keepalives, then the behavior you see is expected.

You're just waiting to read some data, and there are no pending writes. Therefore the TCP stack will wait forever if there are no incoming packets. There could be no incoming packets due to no data being ready, of from the network being down. The TCP stack has no way of knowing, so it cannot notify your code.

I suggest turning on TCP keepalives, which would then allow the TCP stack to notify your code that the connection has been closed.

I'm going to close this issue. If you turn on keepalives and still see this problem, please reopen it.

----------
resolution:  -> invalid
stage:  -> committed/rejected
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13109>
_______________________________________


More information about the Python-bugs-list mailing list