Reset server on Ice::ConnectionLostException

philip_lambphilip_lamb Christchurch, New ZealandPhilip LambMember

Hi,

I'm trialling the use of Ice 3.7 C++ in a server which manages a hardware resource, and running into some confusing behaviour. I'm using two-way connections, and if the client terminates unexpectedly, the server exits with this message:

terminate called after throwing an instance of 'Ice::ConnectionLostException'
  what():  src/Ice/StreamSocket.cpp:249: ::Ice::ConnectionLostException:
connection lost: recv() returned zero
Aborted

The server is using Ice::Service, and I'm not changing any properties from their defaults. Now the docs say that a ConnectionLostException will be logged, but never mention that it will result in program abort.

So my first problem is I need to preventing ConnectionLostException resulting in abort. Secondly, if I could gracefully handle ConnectionLostException and prepare the server for the next connection that'd be helpful. I understand that one can't depend on always receiving that exception as a means of reset, but since I'm managing a hardware resource that takes time and energy to stop and start, it'd be nice to have it ready sooner, on a kind of best-effort basis.

Comments

  • benoitbenoit Rennes, FranceBenoit FoucherOrganization: ZeroC, Inc.Project: IceAdministrators, ZeroC Staff ZeroC Staff

    Hi,

    An Ice server should definitely not abort when the client forcefully close its end of the connection. Can you get of the stack trace of the abort of the server? Please also specify on which platform this is occurring.

    Ice provides a way to not monitor the lifetime of a connection and be notified when the get connection gets closed, see https://doc.zeroc.com/display/Ice37/Connection+Management for more information.

    Cheers,
    Benoit.

  • philip_lambphilip_lamb Christchurch, New ZealandPhilip LambMember

    OK, so I found that this is occurring when the server attempts to call back to the client on the two-way connection. I can catch the exception on that call.

Sign In or Register to comment.