Re: [Quickfix-developers] empty sequence number on sequence reset message
Brought to you by:
orenmnero
From: Oren M. <or...@qu...> - 2004-12-16 18:30:43
|
RE: [Quickfix-developers] empty sequence number on sequence reset = messageIn general these should be caught in the Session::next method, = which is what delegates all the calls such as resend requests and such. = You'll see that a whole list of exceptions are being caught and handled = in various ways. What isn't there currently is a catch block for = std::exception which should log the text of the exception. Having this = should prevent your app from crashing and may give you a better = indication of what it was not able to handle. --oren ----- Original Message -----=20 From: Michael Raykh=20 To: 'Oren Miller'=20 Cc: qui...@li...=20 Sent: Wednesday, December 15, 2004 3:52 PM Subject: RE: [Quickfix-developers] empty sequence number on sequence = reset message Generally speaking, to avoid exceptions like these "crashing" my app, = where these should be caught? -----Original Message----- From: Oren Miller [mailto:or...@qu...] Sent: Wednesday, December 15, 2004 11:41 AM To: Michael Raykh Cc: qui...@li... Subject: Re: [Quickfix-developers] empty sequence number on sequence = reset message Serves me right for not writing a proper functional test for this. = I'll reopen this issue and do it right this time :( --oren ----- Original Message -----=20 From: Michael Raykh=20 To: 'Oren Miller' ; Michael Raykh=20 Cc: 'qui...@li...'=20 Sent: Wednesday, December 15, 2004 10:34 AM Subject: RE: [Quickfix-developers] empty sequence number on = sequence reset message Reported this issue a while back, there was a fix (Session.cpp - = version 1.54-->1.55),=20 but issue is still there:=20 message.getHeader().getField( msgType );=20 if( message.getHeader().isSetField( msgSeqNum ) )=20 message.getHeader().getField( msgSeqNum );=20 if ( message.getHeader().isSetField( possDupFlag ) )=20 message.getHeader().getField( possDupFlag );=20 reject.setField( RefSeqNum( msgSeqNum ) );=20 Instead of line message.getHeader().getField( msgSeqNum ) as = originally,=20 now exception is thrown in reject.setField( RefSeqNum( msgSeqNum ) = );=20 -----Original Message-----=20 From: Oren Miller [mailto:or...@qu...]=20 Sent: Thursday, November 04, 2004 10:54 AM=20 To: Michael Raykh=20 Cc: 'qui...@li...'=20 Subject: Re: [Quickfix-developers] empty sequence number on = sequence=20 reset message=20 Well, when a sequence reset is sent in reset mode (123=3DN) the = spec says=20 that you should ignore the MsgSeqNum. I guess Appia took this to = mean=20 that they can choose to just not send it, even though it is listed = as a=20 required field (not conditionally required) in the standard = header.=20 First thing that we should do is have QF gracefully handle = rejecting a=20 message without a sequence number. This should be accomplished = easily=20 enough by replacing that line with this:=20 if( message.getHeader().isSetField( msgSeqNum ) )=20 message.getHeader().getField( msgSeqNum );=20 This will essentially cause the reject message to say it is = rejecting=20 the message with sequence number 0, which I think is a reasonable = thing=20 to say if there is no sequence number.=20 Now the question is do we want to make an exception for this = message=20 type and process the message that doesn't contain this required = field. =20 I would say since it is our job to "ignore" it, than yes, we = should=20 probably allow it. To accomplish this we will need to allow the=20 nextSequenceReset method to specify that the validate method = should=20 ignore sequence numbers. We can probably do this by rewriting the = method like so:=20 bool Session::verify( const Message& msg, bool checkTooHigh,=20 bool checkTooLow, bool checkSequenceNumber = )=20 { QF_STACK_PUSH(Session::verify)=20 SenderCompID senderCompID;=20 TargetCompID targetCompID;=20 SendingTime sendingTime;=20 MsgType msgType;=20 MsgSeqNum msgSeqNum;=20 try=20 {=20 const Header& header =3D msg.getHeader();=20 header.getField( senderCompID );=20 header.getField( targetCompID );=20 header.getField( sendingTime );=20 header.getField( msgType );=20 if( checkSequenceNumber )=20 header.getField( msgSeqNum );=20 if ( !validLogonState( msgType ) )=20 throw std::logic_error( "Logon state is not valid for = message" );=20 if ( !isGoodTime( sendingTime ) )=20 {=20 doBadTime( msg );=20 return false;=20 }=20 if ( !isCorrectCompID( senderCompID, targetCompID ) )=20 {=20 doBadCompID( msg );=20 return false;=20 }=20 if ( checkSequenceNumber && checkTooHigh && isTargetTooHigh(=20 msgSeqNum ) )=20 {=20 doTargetTooHigh( msg );=20 return false;=20 }=20 else if ( checkSequenceNumber && checkTooLow && = isTargetTooLow(=20 msgSeqNum ) )=20 {=20 doTargetTooLow( msg );=20 return false;=20 }=20 UtcTimeStamp now;=20 m_state.lastReceivedTime( now );=20 m_state.testRequest( 0 );=20 }=20 catch ( std::exception& e )=20 {=20 m_state.onEvent( e.what() );=20 disconnect();=20 return false;=20 }=20 fromCallback( msgType, msg, m_sessionID );=20 return true;=20 QF_STACK_POP=20 }=20 On Nov 4, 2004, at 8:33 AM, Michael Raykh wrote:=20 > In our test of quickFix against Appia fix engine the following = happens:=20 >=20 > - Appia sends sequence reset request msg=20 > - for some reason sequence number field is not populated on this = reset=20 > request=20 > - quickFix decides to reject this=20 > - crashes in generateReject in=20 > message.getHeader().getField( msgSeqNum );=20 > 'cause message seq number is not set...=20 >=20 >=20 >=20 > Is this proper behaviour? Any suggestions how to handle this?=20 > This email and any files transmitted with it are confidential = and=20 > intended solely for the use of the individual or entity to whom = they=20 > are addressed. If you have received this email in error please = notify=20 > the system manager. This message contains confidential = information and=20 > is intended only for the individual named. If you are not the = named=20 > addressee you should not disseminate, distribute or copy this = e-mail.=20 This email and any files transmitted with it are confidential and = intended solely for the use of the individual or entity to whom they are = addressed. If you have received this email in error please notify the = system manager. This message contains confidential information and is = intended only for the individual named. If you are not the named = addressee you should not disseminate, distribute or copy this e-mail.=20 This email and any files transmitted with it are confidential and = intended solely for the use of the individual or entity to whom they are = addressed. If you have received this email in error please notify the = system manager. This message contains confidential information and is = intended only for the individual named. If you are not the named = addressee you should not disseminate, distribute or copy this e-mail. |