Anu Thomas created PROTON-2823: ---------------------------------- Summary: Proton-J does not raise transport closed when TCP FIN+ACK arrives followed by TCP RST Key: PROTON-2823 URL: https://issues.apache.org/jira/browse/PROTON-2823 Project: Qpid Proton Issue Type: Bug Components: proton-j Affects Versions: proton-j-0.34.1 Reporter: Anu Thomas Attachments: image-2024-05-14-11-36-02-828.png
We’ve noticed that after establishing the connection to the broker, if the broker network initiates the "TCP connection close FIN+ACK, along with RST" then the Proton-J does not signal a terminal event (e.g., transport close), which leaves the client application unable detect such a connection termination and recover. The traffic flow is – # TCP layer on the service side sends FIN+ACK # Client TCP layer respond with FIN+ACK # TCP layer on the service side sends TCP RST # The Proton-J does not propagate any terminal event (e.g., transport close) to the registered handler for application to react to this disconnect. Below is a Wireshark captured view of this traffic - !image-2024-05-14-11-36-02-828.png! While analyzing this, when this happens, we have noticed the following internally to Proton-J - # Proton-J SimpleSslTransportWrapper layer is in fact detecting this close [here|https://github.com/apache/qpid-proton-j/blob/adb9ebcc1cf76e18f1ef176fd77a4ae6a73cd557/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/ssl/SimpleSslTransportWrapper.java#L232] and it marks its _head_closed flag as true indicating the outbound is closed. # Proton-J TrasportImpl even generate TRANSPORT_HEAD_CLOSED event but it never generates TRANSPORT_TAIL_CLOSED event, or TRANSPORT_CLOSED event which requires tail_close also to happen. # The Proton-J also frees all the internally registered Selectables, for example the Selectable associated with the TCP Connection and gracefully shut down these resources (and associated channels, timers tracking idle timeout). # We can also see that the internal [connectionFree|https://github.com/apache/qpid-proton-j/blob/adb9ebcc1cf76e18f1ef176fd77a4ae6a73cd557/proton-j/src/main/java/org/apache/qpid/proton/reactor/impl/IOHandler.java#L319] handler in the IOHandler is invoked (note: none of the other terminal handlers (connectionError, connectionExpired) are invoked) I created below PR to address this - where it closes the transport tail when connection is free-ed, resulting in Proton-J signaling the transport termination to the application handlers. With this fix, the application is able to detect the connection drop and recover. [Close transport tail when freeing connection to avoid the client application hanging when TCP FIN+ACK arrives along with TCP RST. by anuchandy · Pull Request #44 · apache/qpid-proton-j (github.com)|https://github.com/apache/qpid-proton-j/pull/44] Can please experts from the Proton-J community take a look at this / fix? -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org