[QFJ-907] Dead sockets are not closed when SocketInitiator is stopped Created: 04/Nov/16  Updated: 17/Jul/17  Resolved: 17/Jul/17

Status: Closed
Project: QuickFIX/J
Component/s: Engine
Affects Version/s: 1.5.3
Fix Version/s: 1.6.2

Type: Bug Priority: Default
Reporter: Paul Rowe Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None

Attachments: File QFJ-907.patch    
Issue Links:
Duplicate
duplicates QFJ-849 SocketInitiator does not stop properly Closed

 Description   

Steps to reproduce:

1. Create a socket initiator that connects to a socket that does nothing
2. Start the initiator and observe that it connects to the socket
3. Stop the initiator before the reconnectinterval kicks in
4. Observe that the socket remains open

Background:

Recently we observed that during our session end schedule processing, a client will logoff on time ... we delay a bit, and then we close our socket initiator. In-between the time the client logged off and the time that we closed the socket initiator, a new socket connection was established to the client. This connection was "dead," e.g. it did not respond to FIX requests/responses. This dead socket remained connected until the next session start, where an additional socket was opened. Just after a new additional socket was opened, the client realized they had a dead connection open to us, and decided to close that dead connection.

We have special handling on SessionStateListener.onConnect() and SessionStateListener.onDisconnect(). When a new socket was created on the session start, SessionStateListener.onConnect() was called. This led us to believe everything was OK with this session. Then, when the dead socket was closed, SessionStateListener.onDisconnect() was called just after. This broke our internal logic because we thought this session was disconnected, when in fact it was operating normally.

To avoid this problem in the future, if rogue dead sockets are created, then it should be up to the initiator to close these sockets.



 Comments   
Comment by Paul Rowe [ 04/Nov/16 ]

QFJ-907.patch attached to this issue. This patch contains a unit test that replicates this issue and the corresponding fix that fixes this issue.

Comment by Christoph John [ 04/Nov/16 ]

Hi Paul Rowe,
thanks for the issue and the suggested fix.
Did you try this with a newer version, i.e. QFJ 1.6.2? From what I can gather from your attached patch it might have been fixed with QFJ-849. Could you please check?
https://github.com/quickfix-j/quickfixj/commit/305b60030268f2aade427633127b7d3bae79130f

Thanks,
Chris.

Comment by Christoph John [ 29/Mar/17 ]

Hi Paul Rowe, are you able to confirm?
Thanks,
Chris.

Generated at Sat Nov 23 01:29:25 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.