FIX8 client crashing during re-connection with server

70 views
Skip to first unread message

gurmee...@utradesolutions.com

unread,
Jun 30, 2017, 6:34:09 AM6/30/17
to fix8 support
Hi,

I am using fix8 client and server both. My server side is running quite good but there is a problem in client part.

Firstly, I am getting crash when server disconnects and client tries to re-connect again and again after some time interval. I am starting a thread on client side to reconnect whenever connectivity breaks. This crash was too frequent but with some code changes and checks, it is bit stable but still i am getting this crash randomly.

here is logs, code snippet and backtrace for more clarity

Backtrace:
#0 0x00007f806ee3e213 in pthread_join () from /lib64/libpthread.so.0
#1 0x0000000000837b06 in FIX8::Logger::~Logger() ()
#2 0x0000000000837cb2 in FIX8::FileLogger::~FileLogger() ()
#3 0x0000000000dae9b8 in FIX8::ClientSession<ut::route::Fix8Session>::~ClientSession() ()
#4 0x0000000000da9060 in ut::route::Node::start(bool) ()
#5 0x0000000000daff7f in ut::route::Node::retryConnecting(bool) ()
#6 0x00000000008eb8bb in thread_proxy ()
#7 0x00007f806ee3daa1 in start_thread () from /lib64/libpthread.so.0
#8 0x00007f806e1a0bcd in clone () from /lib64/libc.so.6

Logs:
====Retrying to connect====== SessionName: TEX1
Session State : logoff_sent
Is session Shutdown : 1

====Retrying to connect====== SessionName: TEX1
Session State : logoff_sent
Session State Not Logged in:
Session State Logon Sent:
Session: TEX1...started
Session State Logon Received:
Session Disconnected, State : 7

====Retrying to connect====== SessionName: TEX1
Session State : logoff_sent
Is session Shutdown : 1

====Retrying to connect====== SessionName: TEX1
Session State : logoff_sent
Is session Shutdown : 1
Session: TEX1...started

Code snippet:

_retryInterval = 1 sec

void retryConnecting(bool isFirstTime)
{
while(true)
{
if(_IsConnected) break;

if(time(NULL) - _LastConnectivityTry >= _retryInterval )
{
if(!_IsConnected){
std::cout << "====Retrying to connect====== "
<< "SessionName: " << _sessionName
<< std::endl;
start(false);
_LastConnectivityTry = time(NULL);
}
}
usleep(10);
}
}

void Node::start( bool firstTime)
{
try
{
if(connection)
{
FIX8::States::SessionStates state = connection->session_ptr()->get_session_state();
std::cout << "Session State : " << FIX8::Session::get_session_state_string(state) << std::endl;

if( state == FIX8::States::st_logon_sent ||
state == FIX8::States::st_logon_received ||
state == FIX8::States::st_continuous ||
state == FIX8::States::st_wait_for_logon )
return;
}

if(!firstTime)
{
if(connection)
{
std::cout << "Is session Shutdown : " << int(connection->session_ptr()->is_shutdown()) << std::endl;
if( !connection->session_ptr()->is_shutdown() &&
FIX8::States::is_live( connection->session_ptr()->get_session_state() ) )
{
return;
}
}
connection.reset(
new FIX8::ClientSession<Fix8Session>(
FIX8::TEX::ctx(),
_conf,
_sessionName
)
);

_session = static_cast<Fix8Session *>(connection.get()->session_ptr());
NodeManager::instance().updateRoute(_session, shared_from_this());
usleep(1000);
}
////////////////////////
_session->initializeSequence( _sessionName );
//////////////////////

_session->setPswd(_pswd);
connection->start(
false,
_nextSend,
_nextReceive,
connection->session_ptr()->get_login_parameters()._davi()
);

std::cout << "Session: " <<_sessionName << "...started" << std::endl;
}
catch(FIX8::f8Exception& e)
{
std::cerr << "exception: " << e.what() << std::endl;
throw;
}
}


Please help me to resolve this issue.

---
Thanks
Gurmeet Singh
Reply all
Reply to author
Forward
0 new messages