You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Messages are dropped when sent after EndTime or before StartTime #986
I have noticed that if session is created with a schedule, then you can loss messages if submitted before session start time. Could be legit case but it contradict to this
Sessions exist whether or not a counter party is connected to it. As soon as a session is created, you can begin sending messages to it. If no one is logged on, the messages will be sent at the time a connection is established with the counterparty.
To Reproduce
in order to reproduce issue you need to make sure that session start time is in future (few minutes, hours, etc)
Expected behavior
Is it possible to fix code in a way that if session object is created and you send messages to the session, they are not dropped (reset by periodic timer) ? Probably that's ok to clear session state upon session end time, but everything that is submitted into session between session end and session start should be sent out at session start (if connected)
I looked this issue and #463. After checking Session.java I found:
The session reset (next(), Session.java) runs automatically when the session leaves its time window, if the sequence numbers are not 1. This reset is not controlled by ResetOnLogon, ResetOnLogout, or ResetOnDisconnect. It always runs.
The reset clears the MessageStore. Any application message sent while the session is outside its time window is lost when this reset runs.
I also found an existing test, testDisabledSessionIsResetBySchedule, linked to Enabling a previously disabled session might lead to message loss #965. This test checks that messages sent outside the session time window ARE cleared. So this behavior looks intentional, not a bug in the code.
This creates a conflict with the documentation, which says a session exists independently of the connection, and you can send messages to it as soon as it is created. Is this current behavior the intended design, or should it change?
My idea: add a new optional setting (default off, so nothing changes for existing users). When enabled, a message sent outside the session time window is held in memory and sent again after the next successful logon, with a new sequence number.
I wanted to be sure if this approach makes sense to you, and if you would consider a PR like this.
This creates a conflict with the documentation, which says a session exists independently of the connection, and you can send messages to it as soon as it is created. Is this current behavior the intended design, or should it change?
Which documentation are you referring to? Do you mean the FIX spec?
There is a gap between what the FIX spec states (the above) and what QFJ does (probably other FIX engines as well).
If you configure QFJ with NonStopSession=Y then it behaves exactly as the spec states but you need to reset the sequence numbers manually.
Now if you add the session schedule (a concept that AFAIK is not mentioned anywhere in the FIX spec) you might ask if the session really exists between EndTime and StartTime... there are at least two opinions on this. ;)
I agree that the current behaviour is unexpected and cumbersome. We should try to fix it. But we cannot store the intermediate messages only in memory because then they will be gone on an app restart. IMHO we should leverage the existing message store for this.
I think it could work when tracking the message sequence number of the last message that was sent (so we probably also need to track disconnections) and when the session is reset (by schedule, not that reset on logon) we need to move the messages that were not already sent to the fresh store.
About the documentation: I mean the Javadoc of Application.onCreate():
As soon as a session is created, you can begin sending messages to it. If no one is logged on, the messages will be sent at the time a connection is established with the counterparty.
This text does not talk about the session schedule. This is why the behaviour was not clear to me.
You are right, keeping the messages only in memory is not safe. They are lost when the app restarts. Using the message store is a better idea.
My proposal:
Keep the sequence number of the last message that was really sent. Update it after each send and on disconnect.
When the session is reset by the schedule (not by ResetOnLogon), copy the messages that were not sent yet into the new store, with new sequence numbers.
After the next logon, send these messages.
I have two questions:
Where should we save the "last sent sequence number"? In the MessageStore (this changes the interface and all store types), or in a separate file/table?
Should this be a new option (default off), or the new default behaviour?
ah, I completely missed that note on the Application interface. 👍
Your proposal makes sense.
Regarding the store: I'd suggest to have a new default method in the interface that does nothing by default (in case someone made a custom store implementation). I think a separate file/table would be better regardless.
Regarding the option: I think it should be an option, but I am still not sure if on or off by default...
changed the title [-]Messages are dropped when "NotInSession"[/-][+]Messages are dropped when sent after `EndTime` or before `StartTime`[/+]on Oct 2, 2026
Activity
chrjohn commentedon Jun 12, 2025
Also see #463
Open to discussion or solution proposals.
aymenjamaaoui commentedon Sep 22, 2026
I looked this issue and #463. After checking Session.java I found:
This creates a conflict with the documentation, which says a session exists independently of the connection, and you can send messages to it as soon as it is created. Is this current behavior the intended design, or should it change?
My idea: add a new optional setting (default off, so nothing changes for existing users). When enabled, a message sent outside the session time window is held in memory and sent again after the next successful logon, with a new sequence number.
I wanted to be sure if this approach makes sense to you, and if you would consider a PR like this.
chrjohn commentedon Sep 29, 2026
Hi @aymenjam ,
Which documentation are you referring to? Do you mean the FIX spec?
There is a gap between what the FIX spec states (the above) and what QFJ does (probably other FIX engines as well).
If you configure QFJ with
NonStopSession=Ythen it behaves exactly as the spec states but you need to reset the sequence numbers manually.Now if you add the session schedule (a concept that AFAIK is not mentioned anywhere in the FIX spec) you might ask if the session really exists between
EndTimeandStartTime... there are at least two opinions on this. ;)I agree that the current behaviour is unexpected and cumbersome. We should try to fix it. But we cannot store the intermediate messages only in memory because then they will be gone on an app restart. IMHO we should leverage the existing message store for this.
I think it could work when tracking the message sequence number of the last message that was sent (so we probably also need to track disconnections) and when the session is reset (by schedule, not that reset on logon) we need to move the messages that were not already sent to the fresh store.
aymenjamaaoui commentedon Sep 29, 2026
Hi @chrjohn!
About the documentation: I mean the Javadoc of
Application.onCreate():This text does not talk about the session schedule. This is why the behaviour was not clear to me.
You are right, keeping the messages only in memory is not safe. They are lost when the app restarts. Using the message store is a better idea.
My proposal:
ResetOnLogon), copy the messages that were not sent yet into the new store, with new sequence numbers.I have two questions:
MessageStore(this changes the interface and all store types), or in a separate file/table?Regards,
Aymen
chrjohn commentedon Oct 2, 2026
Hi Aymen,
ah, I completely missed that note on the
Applicationinterface. 👍Your proposal makes sense.
Regarding the store: I'd suggest to have a new
defaultmethod in the interface that does nothing by default (in case someone made a custom store implementation). I think a separate file/table would be better regardless.Regarding the option: I think it should be an option, but I am still not sure if on or off by default...
Thanks in advance!
Chris
[-]Messages are dropped when "NotInSession"[/-][+]Messages are dropped when sent after `EndTime` or before `StartTime`[/+]Add KeepUnsentMessagesOnReset option
feat(store): support KeepUnsentMessagesOnReset in JdbcStore
Add KeepUnsentMessagesOnReset option
feat(store): support KeepUnsentMessagesOnReset in JdbcStore
Add KeepUnsentMessagesOnReset option
feat(store): support KeepUnsentMessagesOnReset in JdbcStore