Home Help Center

ObjectNotExistException thrown by a datagram proxy

alexjalexj Member Alex JeffreyOrganization: Softopt LImitedProject: Distributed control systems
My application uses Ice merely as IPC with all clients and servers executing on the same platform. As such, I make a lot of use of datagram invocations to achieve a simple publish / subscribe paradigm so that publishers are not aware of whether anyone is listening to their data and clients don't care where it's coming from. The pitfalls associated with UDP (out of order, multiple copies, not guaranteed delivery etc.) are not an issue.

Each of my processes can be a client for some services and a server for some other services. In connection oriented services, this is not an issue but I have recently had a problem when one of my processes needed to be a client for one datagram service and a server for another datagram service. The error originally manifested itself as an ObjectNotExistException thrown from a proxy which I am certain was a datagram (proxy->isDatagram() returned true) which the Ice Manual says never happens (see “Object Existence” on Object Existence and Non-Existence - Ice 3.5 - ZeroC).

The proxies are defined as properties as follows:

SERVICE_A.Proxy=SERVICE_A:udp -p 11000
SERVICE_B.Proxy=SERVICE_B:udp -p 11000

The object adapter endpoint is defined as a property:

SUBSCRIBER.Endpoints=udp -p 11000

I use a separate object adapter for my TCP and UDP services and the SUBSCRIBER endpoint is used by all processes that listen to datagram services.

The problem arose when I added one of my processed started publishing SERVICE_A (i.e. created a proxy) which already subscribed (had a servant for) SERVICE_B. On the first access to a method on the proxy, the ObjectNotExistException was thrown.

The interface provided by the proxy is oneway compatible (no out params, no return values) and I obtain the proxy from the communicator via the property, use the ice_datagram() factory method on the untyped proxy and then use uncheckedCast() so no communication with the server is required. I have Network and Protocol trace enabled and no traffic is generated by the failing proxy access.

I fixed this (or at least made the error go away) by changing the SUBSCRIBER endpoint to have no specific port assigned to it. This prevented the crash but obviously stopped the service working.

SUBSCRIBER.Endpoints=udp

A couple of questions:

Any idea what caused the unexpected exception?

Given that I presume the error is caused by the client and server having the same endpoint (specifically, port number), what is the correct way of dealing with multiple UDP services in the same process? Should they have their own port numbers? Does this mean that the object adapter on subscribers must have multiple endpoints (one per port number?)

I did check the two UDP examples but neither of them are quite what I need.

Thanks.

Alex.

Comments

  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi Alex,

    In the future, please always include the Ice version, programming language, operating system and compiler being used.

    I suspect the ObjectNotExistException is being raised via a collocated invocation. If I understand your situation correctly, a single process has created an object adapter that's listening on the udp -p 11000 endpoint, and also creates a proxy for this same endpoint. Unless you explicitly disable collocation optimization, Ice will attempt to make this call directly.

    If you have multiple processes on the same host attempting to listen on the same port, I'm surprised you're not getting a system error. You should consider using UDP multicast instead.

    Have you considered using IceStorm?

    Regards,
    Mark
Sign In or Register to comment.