[QFJ-412] DynamicAcceptorSessionProvider does not correctly handle disconnected clients Created: 10/Mar/09  Updated: 15/Nov/12  Resolved: 14/Mar/09

Status: Closed
Project: QuickFIX/J
Component/s: Engine
Affects Version/s: 1.3.3
Fix Version/s: 1.5.0

Type: Bug Priority: Default
Reporter: Toli Kuznets Assignee: Toli Kuznets
Resolution: Fixed Votes: 0
Labels: None

Attachments: Text File qfj-412-examples-repro.patch     Text File qfj-412.patch    

 Description   

The existing implementation of DynamicAcceptorSessionProvider does not correctly handle the case where a client disconnects due to network failure - the DynamicAcceptorSessionProvider never detects the disconnect, and the connection appears to still be "active" and the Session is never removed.
As a result, when the client subsequently tries to reconnect, QFJ thnks that is already connected and does not allow for the new connection.

The DynamicAcceptorSessionProvider is setup to accept all incoming connections (based on a specified template). Currently, a new session is created and added to the sessions list, but if you are running a SingleThreadedEventHandlingStrategy the new session is never added to the list of sessions for the SessionConnector.
As a result the main SessionConnector.SessionTimerTask loop that goes through all the known connections and calls Session.next() on them (which tries to send TestRequest to those it hasn't heard from in a while) is never executed for the dynamically-created connections.

The solution is to have the SessionConnector be available to the DynamicAcceptorSessionProvider class, and to add the session to the list of sessions at creation.

You can reproduce this by changing the Executor example to use the DynamicAcceptorSessionProvider, and then connecting to it via Banzai from a different machine.
Disconnect the network cable, wait 2 mins, try to reconnect - the vanilla version of QFJ won't let you re-login b/c it still thinks the first session is active.
With the patch, it'll detect lack of hearbeats and forcibly disconnect the session.



 Comments   
Comment by Toli Kuznets [ 10/Mar/09 ]

patch with changes to fix this bug

Comment by Toli Kuznets [ 10/Mar/09 ]

Temp changes to example Executor to reproduce this problem

Comment by Toli Kuznets [ 14/Mar/09 ]

fix checked in rev 919

Generated at Wed Nov 27 03:04:09 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.