connectionLost never reached after calling loseConnection: stuck in CLOSE_WAIT forever
|Reported by:||demaledetti2||Owned by:|
(diff, github, buildbot, log)
|Author:||exarkun, demaledetti2||Launchpad Bug:|
A is a twisted.internet.tcp.Connection transport connecting a socket to a protocol.
A has a producer C.
A is a consumer of B.
More than 64KB are written to A.
At some point B gives up and tells A to stopProducing (loseConnection).
A.loseConnection stops the reactor from reading OneA and starts it writing.
- it finds the send buffer empty
- it finds a registered producer (C) and resumes it
C never produces any more bytes.
After some time (reactor.callLater 0 is not enough), C unregisters itself from A.
A takes note that it has no more producer, but does nothing about it.
A's protocol's connectionLost is never called even if its peer shuts down the connection.
A's socket is stuck in CLOSE_WAIT state forever with 1 byte in the Recv-Q and 0 bytes in Send-Q.
Exarkun said that the bug is likely that FileDescriptor.unregisterProducer doesn't do anything special when disconnecting=True.
Please see the attached file that demonstrates the problem.
Change History (29)
comment:7 Changed 5 years ago by exarkun
- Branch changed from branches/close_wait-forever-4719 to branches/close_wait-forever-4719-2
comment:11 follow-up: ↓ 12 Changed 5 years ago by exarkun
- Keywords review removed
- Owner changed from glyph to demaledetti2
comment:12 in reply to: ↑ 11 Changed 5 years ago by demaledetti2
- Owner changed from demaledetti2 to exarkun
comment:19 Changed 5 years ago by exarkun
- Keywords review added
- Owner exarkun deleted
- Priority changed from normal to high