Home Bug Reports

CloseConnectionException and one_way tcp proxy

garrygarry Member
I'm using 2.1.0 version. My scenario is the following: a client uses uncheckedCast to get a one way tcp proxy to a server. After some period of inactivity a server 'closes' connection. After that a client tries to invoke some method through instantiated proxy but gets back CloseConnectionException, ConnectionI.cpp, 1993 exception. I thought that connection re-establishment is a part of ICE runtime.


  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    Can you run your client with --Ice.Trace.Retry=3, and post the results here?
  • garrygarry Member
    My guess is, in IceProxy::Ice::Object::__handleException, line 697, there is a check, if(ice_isOneway() || ice_isBatchOneway()) and after that ex.ice_throw();
    So regardless of exception type, one_way is not retriable. Alhtough, I think, if connection is closed, we may retry, especially for nonmutating operations.
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi Garry,

    You're absolutely correct. This was changed recently with Ice 2.1.0, here's the entry from the CHANGES file:
    - We do not retry oneway or batch oneway requests anymore, except if
    there are problems during connection establishment. If we retry a
    oneway or batch oneway, previous oneways from the same batch, or
    previous oneways that are buffered by the IP stack implementation,
    are silently thrown away. This can lead to a situation where the
    latest oneway succeeds due to retry, but former oneways are

    The motivation behind this change is to inform the Ice client that the connection has been closed and that eventually some oneway or batch oneway which were still queued in the TCP/IP buffers might have been lost. Previously, if the connection was closed, some oneway or batch oneway might have been lost and because of the automatic retry you wouldn't have been aware of it.

    As you have noticed, this doesn't play well with active connection management which closes connections if it's idle... So if you want to use oneway with your application, I would recommend disabling ACM (by setting Ice.ConnectionIdleTime to 0). You could also use twoway requests instead of oneway, twoway requests will always be retried (and are reliable unlike oneway).

    Note that we are still discussing internally solutions to have oneway and ACM work better together... In the meantime, let us know if you need more information!

  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    After some internal discussion, we've decided to back out this change. In the next patch release (2.1.1), Ice will behave the same way as it used to before 2.1.0. That is, it will transparently retry to establish the connection associated to the proxy if for some reasons it was closed. Please, let us know if you need more information!

  • garrygarry Member
    My suggestion is to stick with old behaviour by default, and introduce new behaviour via config options. In that case Ice upgrades would have less impact on applications.
Sign In or Register to comment.