Re: [Quickfix-developers] sequence reset loop when receiving invalid messages
Brought to you by:
orenmnero
From: Oren M. <ore...@ya...> - 2003-07-13 17:16:16
|
We actually have a test in the 'future' directory for this situation. http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/quickfix/quickfix/test/definitions/server/future/14h_RepeatedTag.def?rev=1.1.1.1&content-type=text/vnd.viewcvs-markup The future tests are acceptance tests for features that have not yet been implemented, but they show the expected behavior of this situation including what the reject should look like. The problem really is that this particular error should be caught in validation before all the fields are stuffed in a message. The reason InvalidMessage is thrown is because the fields are being stuffed in a map with an integer key, so the second occurance of a field overwrites the previous one. The means the parsed object will be shorter than the one actually sent (less fields) which causes the length and checksum tests to fail giving us the erroneous Invalid Message exception. At this point it is not possible for us to know if the message had a duplicate field which should be rejected, or is a corrupted message which should be ignored (according to the spec). I think we need a new exception which can be thrown during validation or parsing (RepetedTag or something), which will explicitly inform the session of this situation. "Van Gelder Eddy (KAOB 41)" <edd...@cr...> wrote: Hi, when receiving a FIX message with e.g. two times the same field, the message is discarted. Upon the next valid message, a sequence number mismatch is detected and a sequence reset is sent. The remote engine resends the invalid message and we enter an infinite loop. I've trace the problem to void Session::next( const std::string& msg ) { QF_STACK_PUSH(Session::next) m_state.onIncoming( msg ); next( Message( msg, m_dataDictionary ) ); QF_STACK_POP } The problem is encountered in next( Message( msg, m_dataDictionary ); the next loop is not executed and the sequence number not increased if the Message constructor throws an InvalidMessage. I've solved the problem by catching the InvalidMessage void Session::next( const std::string& msg ) { QF_STACK_PUSH(Session::next) m_state.onIncoming( msg ); try { Message my_msg( msg, m_dataDictionary ); next( my_msg ); } catch ( InvalidMessage& ) { m_state.onIncoming( "INVALID MESSAGE RECEIVED" ); Message my_msg ( msg, false ); generateReject(my_msg,13); m_state.incrNextTargetMsgSeqNum(); } Unfortunately I do not know the exact reject reason I put 13 ( TAG_APPEARS_MORE_THAN_ONCE ) because that was the case here. Could another Message constructor be used and the message validation be left for void Session::next( const Message& message ) ? best regards, Eddy Van Gelder ------------------------------------------------------- This SF.Net email sponsored by: Parasoft Error proof Web apps, automate testing & more. Download & eval WebKing and get a free book. www.parasoft.com/bulletproofapps1 _______________________________________________ Quickfix-developers mailing list Qui...@li... https://lists.sourceforge.net/lists/listinfo/quickfix-developers --------------------------------- Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! |