Home Help Center

Glacier2, connectivity and custom operation timeout

allroallro Member Alex LeidermanOrganization: Cell2BetProject: Management Server
Hi,

I have a question regarding custom operation timeout and disconnection detection.

Let's consider an application that is similar to chat client from ICE demo-s.
In this case client works with "CustomSession", for example:
interface CustomSession extends Glacier2::Session {
	... [B]myHeavyOperation[/B](...);
};
where myHeavyOperation function call may take up to 30 secs to be completed.

In order to keep our session alive we have to run ping on our CustomSession proxy or refreshSession on router proxy.
Our client detects disconnection if this "keep-alive" procedure throws Ice::TimeoutException.

According to ICE manual Glacier2 Session Timeouts - Ice 3.4, client can use only ONE timeout working via Glacier:
whatever timeout you set on the router proxy that you use to create the session is the timeout that applies to all routed proxies.

Conclusion:
In our case, we will detect "disconnection" and "failed to connect" situations only after 30 secs.
The only workaround I can see is to create another connection to Glacier that will be dedicated for disconnection detection.

Is it correct?
What is a recommended way to detect a disconnection from Glacier using a timeout that is shorter than a timeout used for the heaviest function in our interface?

Comments

  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi Alex,

    You should make sure that all the operations you invoke on the backend servers through Glacier2 take much less time than the timeout value set for the Glacier2 router proxy to return.

    Otherwise, if a request triggers the timeout, the connection between Glacier2 and your client is closed and the Glacier2 session is destroyed since it's tight to the Ice connection.

    For long lived operations, it's best to have a method to start the processing and then use an observer interface to receive feedback on the status of the operation and eventually the result. For example, the Slice could be something like the following:
    interface ProgressObserver
    {
         void completed();
    };
    
    interface Session
    {
          void startLongRunningOperation(ProgressObserver* observer);
    };
    

    Cheers,
    Benoit.
Sign In or Register to comment.