[QFJ-790] Logout message not propagated to the fromAdmin() callback Created: 09/Jun/14  Updated: 22/May/15  Resolved: 07/Dec/14

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

Type: Bug Priority: Default
Reporter: Andrzej Hajderek Assignee: Christoph John
Resolution: Fixed Votes: 0
Labels: None

Attachments: Java Source File LostLogoutTest.java    
Issue Links:
Duplicate
is duplicated by QFJ-566 Incoming Logout message doesn't go to... Closed
is duplicated by QFJ-804 Race condition between sessionClosed ... Closed

 Description   

Hi,

A QuickFIX/J based application may miss a Logout request message, if the sender closes the socket shortly after sending the Logout request message. As result the application may lose important information about the reason of disconnection.

Most likely the reason of such behaviour of QuickFIX/J is such that the QFJ Message Processor stops processing queued messages as soon as it detects hasResponder() == false, which may happen even, if the input queue contains messages (or merely the Logout message). Basically the more loaded the receiver's machine is (in terms of CPU/IO) the more likely it is that it misses the Logout message.

Please note that even though the fromAdmin() callback is not called in such cases, the onLogout() is always called (because of the the closed socket). However, multiple occurrences of the same sender-side series of events (Logout + socket close) will lead to two different receiver-side behaviours on a random basis. In some cases the receiver will see the proper fromAdmin() callback and the onLogout() callback, while in some cases it will see only the onLogout() callback (triggered by socket close rather than by the incoming Logout message).

This has been an issue since 1.0.x, but only now I found some time to write a proper test.

Test code attached.

Regards,
Andrzej Hajderek



 Comments   
Comment by Andrzej Hajderek [ 09/Jun/14 ]

If the delay code is removed from the Server.fromApp() method the Logout message will be received correctly in many cases, but it's not guaranteed. The test code is written in such a way that the server always misses the message, but the probability of missing the Logout message is really a function of the delay value within Server.fromApp(). In other words - the more time is spent it Server.fromApp() the more likely it is that the server misses the Logout message.

Comment by Christoph John [ 16/Oct/14 ]

Hi Andrzej, finally I found some time to look at your test. I tested this with 1.6.0-SNAPSHOT and the problem seems to be that the Logout message is received but discarded by Session.isValidLogonState() since it is a Logout message but the session is already disconnected. Fixing that method should be minimal effort but of course your test is highlighting a bigger problem (similar to QFJ-804, QFJ-810). Will take a look at those tickets.

Generated at Sat May 04 11:43:35 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.