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

bug in ice_getCachedConnection ?

I'm not sure if this is a bug or not, but it seems to defy the behavior in the manual:

In the IceRuby bindings, I can't get the ice_getCachedConnection() method to ever return anything but nil. Whether the connection is really open, closed, or I'm using a locator, even if I force connection caching with ice_connectionCached(), it always seems to just return nil and doesn't return any type of Connection information like ice_getConnection(). I've kind of assumed this was because I was using locators, but the Ruby bindings don't exhibit any change when not using a location service so I thought I would bring it up.

All that said, I've noticed that the C++ version of ice_getCachedConnection always seems to return null (which might explain what's going on in the Ruby bindings). Again, I've verfied my connection is established and can see it via netstat, but never get anything other than a null proxy with ice_getCachedConnection(). Again, this might be something to do with locators; I'm not sure.

Is there a trick to using ice_getCachedConnection or a gotcha that may not be in the manual?

Separately, when I was testing connection failures, I was able to create this error:
irb(main):015:0> ps.getPublishedValue(200)
Ice::TimeoutException: Ice::TimeoutException
        from (eval):345:in `invoke'
        from (eval):345:in `getPublishedValue'
        from (irb):15
irb(main):016:0> ps.getPublishedValue(200)
Ice::ConnectFailedException: Ice::ConnectFailedException
        from (eval):345:in `invoke'
        from (eval):345:in `getPublishedValue'
        from (irb):16
irb(main):019:0> ps.ice_getCachedConnection
RuntimeError: unknown Ice exception: IceUtil::NullHandleException
.... un-useful backtrace



  • matthew
    matthew NL, Canada
    Thanks for the report. This is a bug in the ruby plug-in. It will be fixed for Ice 3.2.1. To fix this apply the following patch to src/IceRuby/Proxy.cpp:

    index 98fa699..3601eba 100644
    --- a/rb/src/IceRuby/Proxy.cpp
    +++ b/rb/src/IceRuby/Proxy.cpp
    @ IceRuby_ObjectPrx_ice_getCachedConnection(VALUE self)
    Ice::ObjectPrx p = getProxy(self);
    Ice::ConnectionPtr conn = p->ice_getCachedConnection();
    - if(!conn)
    + if(conn)
    return createConnection(conn);
  • Thanks, Matthew!