quickfixj
quickfixj copied to clipboard
Sequence Numbers for the Logout Message not validated
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
- Initiator sends a Logon with Sequence Number 1
- Acceptor sends a Logon with Sequence Number 1
- 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:

@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 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.
- Initiator sends out of sequence Logout message
- Acceptor queues the Logout message and requests a resend
- 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)
- Acceptor does not process the queued Logout message since it received the Gap Fill
- Initirator terminates the connection as it did not receive a Logout response within the timeout