Archived

This forum has been archived. Please start a new discussion on GitHub.

ice_ping error right after createSession() succeed

I have a class named CConnManager and its code like this:
bool CConnManager::Init()
{
	Ice::RouterPrx defaultRouter = m_pCommunicator->getDefaultRouter();
	m_pRouter = Glacier2::RouterPrx::uncheckedCast(defaultRouter);

	return SetupSession();
}
bool CConnManager::SetupSession()
{
	try
	{ 
		m_pSession = m_pRouter->createSession("", "");
		m_bConnected = true;
		m_pSession->ice_ping();
	}catch (const Ice::Exception& e)
	{
		m_bConnected = false;		
    	}
	return m_bConnected;
}
When I first call Init(),everything is ok. I can connect to server,createsession() and ice_ping() successfully. However,after something
wrong with the network and make me offline, I will call SetupSession() to reconnect. In this case, I can call m_pRouter->createSession()
successfully while meet a ConnectionLostException when I call m_pSession->ice_ping().

Could you tell me what kinds of reason cause the problem?
Thank you.

Comments

  • benoit
    benoit Rennes, France
    Hi,

    The best way to figure out the reason of the ConnectionLostException is to enable network tracing on your client with (--Ice.Trace.Network=2) and tracing on the Glacier2 router to see why requests are rejected with (--Glacier2.Router.Trace.Reject=1). Could you enable this tracing and post the part of the traces when you get the ConnectionLostException?

    Also, which Ice version do you use? Are you creating an object adapter in your client? There's currently a limitation in Ice which will prevent creating multiple sessions with the same communicator and router (unless you create an object adapter associated to the router for each session). To not run into this issue, the best is to destroy the communicator after the session is destroyed and re-recreate it when you create the session (you should make sure to not re-use proxies associated to the old communicator) or to create an object adapter associated to the router for each session.

    Fixing this is on our TODO list, if you have a commercial interest in Ice and if you would like a patch rather sooner than later, please contact us at info@zeroc.com.

    Cheers,
    Benoit.
  • Change in behaviour?

    Hello Benoit,

    has the status of this situation changed with 3.2.1? We are experiencing client lock-ups when trying to create a subsequent session on the same communicator (no object adapter on the client) requiring "kill -9".

    If this is the problem, would it be a better workaround to add an object adapter or to have a second communicator?

    Thanks for your time,
    Josh
  • benoit
    benoit Rennes, France
    Hi,

    No, we didn't get a chance to tackle this issue for 3.2. We might fix it for the next non binary compatible release. I recommend using one of the workaround I mentioned above in the meantime.

    Note that it's not clear to me why this bug would cause a hang however, perhaps it's another problem? You should take a look at the stack traces of the application which is hanging to see if this can give you additional clues.

    Cheers,
    Benoit.