quickfix
quickfix copied to clipboard
Race condition during session Logout / reconnect
There seem to be a window, before the session's state is completely updated, between the time a Logout message (MsgType=5
) is being processed (and store next sequence number is being reset) and when the application is being notified of the logout where the application can still send message and cause the store sequence number to increment.
This translates into the Logon
message to have SeqNum != 1
as it should be with ResetOnLogout=Y
. If the server expects a Logon
on SeqNum=1
, it will send a Resend Request (MstType=2
). The initiator will interpret this as an error and reconnect later, to run into the same issue, this time with SeqNum=3
Here's the conversation details, around the logout:
8=FIX.4.2|9=110|35=5|52=20191007-18:06:54.060|49=Target|56=Sender|34=7335115|58=server terminated|10=XXX|
8=FIX.4.2|9=89|35=5|34=7333563|49=Sender|52=20191007-18:06:54.077|56=Target|10=XXX|
[...]
Disconnected
[...]
8=FIX.4.2|9=172|35=A|34=2|49=Sender|52=20191007-18:07:24.280|56=Target|96=XXX|98=YYY|98=0|108=30|10=066|
8=FIX.4.2|9=92|35=2|52=20191007-18:07:24.284|49=Target|56=Sender|34=1|7=1|16=0|10=250|
Invalid Session State: Received Msg 8=FIX.4.29=9235=252=20191007-18:07:24.28449=Target56=Sender34=17=116=010=250 while waiting for Logon