quickfixj icon indicating copy to clipboard operation
quickfixj copied to clipboard

Sequence Numbers for the Logout Message not validated

Open julianrpereira opened this issue 3 years ago • 2 comments
trafficstars

Describe the bug When receiving a Logout message with a sequence gap a Logout message is sent out as a response instead of a ResendRequest to recover the gap and then logging out.

To Reproduce

  1. Initiator sends a Logon with Sequence Number 1
  2. Acceptor sends a Logon with Sequence Number 1
  3. Initiator sends a Logout with Sequence Number 5

Actual next step: 4. Acceptor sends a Logout with Sequence Number 2

Expected behavior 4. Acceptor sends a Resend Request to recover messages from the Initiator with Sequence Numbers 2, 3 and 4 and then Logout on receiving the missed messages

system information:

  • OS: Windows, Linux
  • Java version JDK11
  • QFJ Version 2.3.0

Additional context Note that on the next Logon if the Initiator sends a Logon message with Sequence Number 5 (and Reset Sequence=No), then a Resend Request is generated to request from sequence 2.

Impact: In the event that the Initiator Logs on the next session with Reset Sequence = Yes, then we have missed those messages as a Resend Request will not be triggered.

Example sequence of events: image

julianrpereira avatar Jan 21 '22 20:01 julianrpereira

@julianrpereira I think this should be an easy fix, IIRC this is just controlled by a boolean flag. Are you willing to submit a PR? We should verify that the Logout process times out to prevent a lengthy resend process.

chrjohn avatar Jan 24 '22 16:01 chrjohn

@chrjohn thanks for reviewing. Yes I saw the boolean flag you are referring to. Will submit a PR for same. I do see a potential problem, I maybe wrong. Appreciate your opinion on the below flow.

  1. Initiator sends out of sequence Logout message
  2. Acceptor queues the Logout message and requests a resend
  3. Initiator will send all missed messages and a Gap Fill instead of the Logout message (as Heartbeats/Logons and Logouts are not required to be recovered)
  4. Acceptor does not process the queued Logout message since it received the Gap Fill
  5. Initirator terminates the connection as it did not receive a Logout response within the timeout

julianrpereira avatar Feb 02 '22 18:02 julianrpereira