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

Collocation Optimization with IcePack: a bug?

I've found what seems really like a bug of collocation optimization, when using a registry to object resolution.

If I simply get the proxy for my object with:

prx = MyObjectPrx::uncheckedCast(ic->stringToProxy("myObject"));

there is no way to get the collocation optimization enabled.
While, if I explicitly contact the registry to get the proxy:

IcePack::AdminPrx admin = IcePack::AdminPrx::uncheckedCast(ic->stringToProxy("IcePack/Admin"));
prx = MyObjectPrx::uncheckedCast(admin->getObjectDescriptor(stringToIndentity("myObject")).proxy);

all works fine.
Why such a strange behavior when, looking at code and sniffing packets, both methods seem to end up with the same remote request to the registry?

Thanks in advance,

P.S. I'm compiling Ice-2.1.2 right now


  • benoit
    benoit Rennes, France
    Thanks for the report.

    The Ice runtime only looks at the given proxy to figure out wether or not to make a collocated invocation. If the proxy only contains an identity (i.e.: "myObject"), there's no object adapter information (endpoints or adapter id) and the Ice runtime can't figure out if it points to a local object or not and will always use remote invocations.

    We will look into fixing this. In the meantime, you can also use the IcePack::Query::findObjectById() method to retrieve the proxy of the object (this proxy contains the adapter id or endpoints and therefore will allow collocated invocations).