[QFJ-730] Wrong SeqNum in the last Sequence Reset message after a Resend Request Created: 18/Feb/13  Updated: 21/Apr/16  Resolved: 04/Jan/16

Status: Closed
Project: QuickFIX/J
Component/s: None
Affects Version/s: 1.5.3
Fix Version/s: 1.6.2

Type: Bug Priority: Major
Reporter: Damien Vidal Assignee: Flakron Vranovci
Resolution: Fixed Votes: 0
Labels: ResendRequest,
Environment:

Eclipse, Windows



 Description   

In the function nextResendRequest(Message resendRequest) you have this code at the end of the loop

if (begin != 0)

{ generateSequenceReset(begin, msgSeqNum + 1); }

if (endSeqNo > msgSeqNum) {
endSeqNo = endSeqNo + 1;
final int next = state.getNextSenderMsgSeqNum();
if (endSeqNo > next)

{ endSeqNo = next; }

generateSequenceReset(beginSeqNo, endSeqNo);
}

=> when you are on the case generating two Sequence Reset at the end of resend request you have an issue of FIX(34) in the last Sequence Reset:

Sequence Reset Message 1 begin != 0 => FIX(34)=begin => OK
Sequence Reset Message 2 endSeqNo > msgSeqNum => FIX(34)=beginSeqNo but beginSeqNo < begin => critical error in protocol it have to be FIX(34)=msgSeqNum+1 ( value sent in the message 1 with NewNoSeq=msgSeqNum+1)



 Comments   
Comment by Damien Vidal [ 19/Feb/13 ]

More details about this issue :

In the default implementation of QFJ you don't have this case but if you change the store implementation removing the persistance of the administrative messages you will have this issue. The loop done with the stored messages supports this case detecting a gap between each FIX(34). Only the last 2 messages are wrong when the last messages ( not stored ) were one or more admin messages at the end.

Here the fix I did and tested :

if (begin != 0)

{ generateSequenceReset(begin, endSeqNo + 1); }

else if (current != endSeqNo + 1) {
if (endSeqNo > msgSeqNum) {
endSeqNo = endSeqNo + 1;
final int next = state.getNextSenderMsgSeqNum();
if (endSeqNo > next)

{ endSeqNo = next; }

generateSequenceReset(beginSeqNo, endSeqNo);
}
}

}

Comment by Damien Vidal [ 19/Feb/13 ]

Sorry an error in the fix of my previous comment :

if (begin != 0)

{ generateSequenceReset(begin, endSeqNo + 1); // update the next SeqNum to support a gap }

else if (current != endSeqNo+1) // do it only if needed
{
if (endSeqNo > msgSeqNum)
{
endSeqNo = endSeqNo + 1;
final int next = state.getNextSenderMsgSeqNum();
if (endSeqNo > next)

{ endSeqNo = next; }

generateSequenceReset(current, endSeqNo); // update the SeqNum to support a gap
}
}

Comment by Flakron Vranovci [ 26/Nov/15 ]

Encountered this independently and have submitted a pull request

https://github.com/quickfix-j/quickfixj/pull/48

Comment by Christoph John [ 04/Jan/16 ]

Merged, thanks.

Generated at Sat Nov 23 09:06:49 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.