[Quickfix-users] New Bugs Found
Brought to you by:
orenmnero
|
From: Michael H. <mh...@li...> - 2003-12-02 13:38:51
|
How do I submit these changes or can someone else do them for me.
Bug 1:=20
Heartbeat Interval
Fix Protocol Specs:
The heartbeat interval (n seconds) is declared by the interface using =
the HeartBtInt field in the Logon message. When either end of a FIX =
connection has not sent any data for n seconds, it will transmit a =
Heartbeat message. When either end of the connection has not received =
any data for n seconds, it will transmit a test request message. If =
there is still no heartbeat message received after n seconds then the =
connection should be considered lost and corrective action be initiated. =
See the Fix spec for full definition if in question!
How I found it:
I am using QuickFix to connect to SFE, which uses a modified version of =
Fix.4.0. SFE requires a heartbeat interval of one second. I have to =
download ~6000 records from SFE initially after each logon. Currently, =
if QuickFix is receiving large chunks of data it starves the heartbeats. =
Since 6000 Fix messages using QuickFix takes ~1 minute the heartbeats =
get starved and the connection is terminated at the other end. This fix =
required two changes.
SocketInitiator.cpp, line 146
void SocketInitiator::onData( SocketConnector& connector, int s )
{ QF_STACK_PUSH(SocketInitiator::onData)
SocketConnections::iterator i =3D m_connections.find( s );
if ( i =3D=3D m_connections.end() ) return ;
SocketConnection* pSocketConnection =3D i->second;
while( pSocketConnection->read( connector ) )=20
{
// Modified 11-26-03 by M. Holm. Because heartbeats are being starved!
i->second->onTimeout();
}
QF_STACK_POP
}
SessionState.h, line 128
bool withinHeartBeat() const
{
UtcTimeStamp now;
// Changed on 11-25-03 by M. Holm because it doesn't conform to the =
Fix spec!
return ( ( now - lastSentTime() ) < heartBtInt() );
// return ( ( now - lastSentTime() ) < heartBtInt() ) &&
// ( ( now - lastReceivedTime() ) < heartBtInt() );
}
Bug 2:
Empty message strings causes an exception to be thrown=20
SocketConnection.cpp, line 92
bool SocketConnection::read( SocketConnector& s )
{ QF_STACK_PUSH(SocketConnection::read)
if ( !m_pSession ) return false;
std::string msg;
if ( !readMessage( msg ) ) return false;
// Changed by M. Holm on 11-25-03 because we should not allow empty =
strings to be processed!
if( msg.length() > 0 )
{
m_pSession->next( msg );
return true;
}
else
return false;
QF_STACK_POP
}
Bug 3:
Receiving messages with tag "8=3D2500" or something other then the Fix =
version
Reason:
Since we are using socket streams we are not guaranteed the delivery of =
full messages at any given time. It should not be searching for "8=3D" =
but "8=3DFIX". Some times it finds and uses a tag like "5018=3D2500" as =
the "8=3D" because of the deletion of partial messages. Also we are =
deleting valid partial messages which we receive from time to time which =
causes this problem.
Parse.cpp, line 109
bool Parser::readFixMessage( std::string& str )
throw( MessageParseError&, RecvFailed& )
{ QF_STACK_PUSH(Parser::readFixMessage)
readFromStream();
std::string::size_type pos =3D 0;
if( m_buffer.length() < 2 ) return false;
pos =3D m_buffer.find( "8=3DFIX" ); // Changed by M. Holm on 11-15-03
if( pos =3D=3D std::string::npos ) return false;
m_buffer.erase( 0, pos );
int length =3D 0;
try
{
if( extractLength(length, pos, m_buffer) )
{
pos +=3D length;
if( m_buffer.size() < pos )
return false;
pos =3D m_buffer.find( "\00110=3D", pos-1 );
if( pos =3D=3D std::string::npos ) return false;
pos +=3D 4;
pos =3D m_buffer.find( "\001", pos );
if( pos =3D=3D std::string::npos ) return false;
pos +=3D 1;
str =3D m_buffer.substr( 0, pos );
m_buffer.erase( 0, pos );
return true;
}
}
catch( MessageParseError& )
{
// Modified on 12-1-03 by M.Holm. There is no reason to do this =
because we only have a partial message.
// m_buffer.erase( 0, pos + length );
// throw e;
}
readFromStream();
return false;
QF_STACK_POP
}
I hope this helps some of you. If you think this is wrong and doesn't =
follow the Fix spec then let me know please. It could be possible that =
SFE is doing something a little bit different but I did check the spec. =
and IMHO I believe the above are bugs.
Thanks
Michael Holm
|