Re: [Quickfix-developers] empty sequence number on sequence reset message
Brought to you by:
orenmnero
From: Emil V. <que...@ho...> - 2004-12-16 21:29:09
|
Hi Oren, We also got one unhandled exception in a similar situation - we received logon message with 'fields out of order', which caused Session::generateReject to be called, then it in turn did throw std::logic_error( "Tried to send a reject while not logged on" ); which ended up unhandled and caused the initiator thread to end unhappily :) Of course, adding the ValidateFieldsOutOfOrder setting stopped it from happening. Best regards, Emil >From: "Oren Miller" <or...@qu...> >To: "Michael Raykh" <mr...@li...> >CC: <qui...@li...> >Subject: Re: [Quickfix-developers] empty sequence number on sequence reset >message >Date: Thu, 16 Dec 2004 12:30:38 -0600 >MIME-Version: 1.0 >Received: from sc8-sf-uberspam1.sourceforge.net ([66.35.250.206]) by >mc10-f8.hotmail.com with Microsoft SMTPSVC(6.0.3790.211); Thu, 16 Dec 2004 >09:37:49 -0800 >Received: from projects.sourceforge.net (sc8-sf-list1-b.sourceforge.net >[10.3.1.7])by sc8-sf-uberspam1.sourceforge.net (Postfix) with ESMTPid >EB52A1D0BE6; Thu, 16 Dec 2004 10:31:07 -0800 (PST) >Received: from sc8-sf-mx1-b.sourceforge.net ([10.3.1.11] >helo=sc8-sf-mx1.sourceforge.net)by sc8-sf-list1.sourceforge.net with esmtp >(Exim 4.30)id 1Cf0Of-0004Lx-K6for >qui...@li...; Thu, 16 Dec 2004 10:30:41 -0800 >Received: from smtpout01-04.mesa1.secureserver.net ([64.202.165.79])by >sc8-sf-mx1.sourceforge.net with smtp (Exim 4.41)id 1Cf0Oe-0007bH-K6for >qui...@li...; Thu, 16 Dec 2004 10:30:41 -0800 >Received: (qmail 26867 invoked from network); 16 Dec 2004 18:30:38 -0000 >Received: from unknown (66.134.230.34) by >smtpout01-04.mesa1.secureserver.net (64.202.165.79) with ESMTP; 16 Dec 2004 >18:30:38 -0000 >X-Message-Info: QIy1oIULmHfVuDhxoPgxuVAam7DgymU7Gs9OZr7ESxI= >References: ><4B6...@ex...> >X-MSMail-Priority: Normal >X-Mailer: Microsoft Outlook Express 6.00.2900.2180 >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 >X-Spam-Score: -4.7 (----) >X-Spam-Report: Spam Filtering performed by sourceforge.net.See >http://spamassassin.org/tag/ for more details.Report problems to >http://sf.net/tracker/?func=add&group_id=1&atid=2000010.1 >HTML_FONTCOLOR_BLUE BODY: HTML font color is blue0.1 HTML_MESSAGE > BODY: HTML included in message-4.9 BAYES_00 BODY: >Bayesian spam probability is 0 to 1%[score: 0.0000]0.0 AWL > AWL: Auto-whitelist adjustment >Errors-To: qui...@li... >X-BeenThere: qui...@li... >X-Mailman-Version: 2.0.9-sf.net >Precedence: bulk >List-Unsubscribe: ><https://lists.sourceforge.net/lists/listinfo/quickfix-developers>,<mailto:qui...@li...?subject=unsubscribe> >List-Id: <quickfix-developers.lists.sourceforge.net> >List-Post: <mailto:qui...@li...> >List-Help: ><mailto:qui...@li...?subject=help> >List-Subscribe: ><https://lists.sourceforge.net/lists/listinfo/quickfix-developers>,<mailto:qui...@li...?subject=subscribe> >List-Archive: ><http://sourceforge.net/mailarchive/forum.php?forum=quickfix-developers> >X-Original-Date: Thu, 16 Dec 2004 12:30:38 -0600 >Return-Path: qui...@li... >X-OriginalArrivalTime: 16 Dec 2004 17:37:49.0750 (UTC) >FILETIME=[F671C560:01C4E395] > >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 ----- > From: Michael Raykh > To: 'Oren Miller' > Cc: qui...@li... > 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 ----- > From: Michael Raykh > To: 'Oren Miller' ; Michael Raykh > Cc: 'qui...@li...' > 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), > but issue is still there: > > message.getHeader().getField( msgType ); > if( message.getHeader().isSetField( msgSeqNum ) ) > message.getHeader().getField( msgSeqNum ); > if ( message.getHeader().isSetField( possDupFlag ) ) > message.getHeader().getField( possDupFlag ); > > reject.setField( RefSeqNum( msgSeqNum ) ); > > Instead of line message.getHeader().getField( msgSeqNum ) as >originally, > now exception is thrown in reject.setField( RefSeqNum( msgSeqNum ) >); > > -----Original Message----- > From: Oren Miller [mailto:or...@qu...] > Sent: Thursday, November 04, 2004 10:54 AM > To: Michael Raykh > Cc: 'qui...@li...' > Subject: Re: [Quickfix-developers] empty sequence number on sequence > reset message > > > > Well, when a sequence reset is sent in reset mode (123=N) the spec >says > that you should ignore the MsgSeqNum. I guess Appia took this to >mean > that they can choose to just not send it, even though it is listed >as a > required field (not conditionally required) in the standard header. > > First thing that we should do is have QF gracefully handle rejecting >a > message without a sequence number. This should be accomplished >easily > enough by replacing that line with this: > > if( message.getHeader().isSetField( msgSeqNum ) ) > message.getHeader().getField( msgSeqNum ); > > This will essentially cause the reject message to say it is >rejecting > the message with sequence number 0, which I think is a reasonable >thing > to say if there is no sequence number. > > Now the question is do we want to make an exception for this message > type and process the message that doesn't contain this required >field. > I would say since it is our job to "ignore" it, than yes, we should > probably allow it. To accomplish this we will need to allow the > nextSequenceReset method to specify that the validate method should > ignore sequence numbers. We can probably do this by rewriting the > method like so: > > bool Session::verify( const Message& msg, bool checkTooHigh, > bool checkTooLow, bool checkSequenceNumber ) > { QF_STACK_PUSH(Session::verify) > > SenderCompID senderCompID; > TargetCompID targetCompID; > SendingTime sendingTime; > MsgType msgType; > MsgSeqNum msgSeqNum; > > try > { > const Header& header = msg.getHeader(); > header.getField( senderCompID ); > header.getField( targetCompID ); > header.getField( sendingTime ); > header.getField( msgType ); > if( checkSequenceNumber ) > header.getField( msgSeqNum ); > > if ( !validLogonState( msgType ) ) > throw std::logic_error( "Logon state is not valid for >message" ); > > if ( !isGoodTime( sendingTime ) ) > { > doBadTime( msg ); > return false; > } > if ( !isCorrectCompID( senderCompID, targetCompID ) ) > { > doBadCompID( msg ); > return false; > } > if ( checkSequenceNumber && checkTooHigh && isTargetTooHigh( > msgSeqNum ) ) > { > doTargetTooHigh( msg ); > return false; > } > else if ( checkSequenceNumber && checkTooLow && isTargetTooLow( > msgSeqNum ) ) > { > doTargetTooLow( msg ); > return false; > } > > UtcTimeStamp now; > m_state.lastReceivedTime( now ); > m_state.testRequest( 0 ); > } > catch ( std::exception& e ) > { > m_state.onEvent( e.what() ); > disconnect(); > return false; > } > > fromCallback( msgType, msg, m_sessionID ); > return true; > > QF_STACK_POP > } > > On Nov 4, 2004, at 8:33 AM, Michael Raykh wrote: > > > In our test of quickFix against Appia fix engine the following >happens: > > > > - Appia sends sequence reset request msg > > - for some reason sequence number field is not populated on this >reset > > request > > - quickFix decides to reject this > > - crashes in generateReject in > > message.getHeader().getField( msgSeqNum ); > > 'cause message seq number is not set... > > > > > > > > Is this proper behaviour? Any suggestions how to handle this? > > 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. > > 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. > 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. _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ |