[omniORB] How to guard against endless loops in the server?

Duncan Grisby duncan@grisby.org
Tue Feb 25 12:22:00 2003


On Wednesday 19 February, Daniel Pfeiffer wrote:

> We want to guard against endless loops in the server with a server
> side timeout.  I would expect this to work by interrupting the
> server method and sending an exception to the client (which is
> operating with a longer timeout).

There is no safe way to interrupt a running thread, so there is no way
for the ORB to do this.

The serverCallTimeOutPeriod is used to cope with the situation that a
client starts sending a request, but never finishes. In that case,
without the timeout, a server thread would sit for ever waiting for
the end of the request to arrive. The timeout has no effect once the
request has been received.

> The documentation of serverCallTimeOutPeriod in version 4, sounds like the
> semantics have completely changed since version 3.0.5.  Anyway: What is the
> correct way to guard against runaway server methods in both 3.0.5 and 4.0?

The behaviour has not changed between 3.0.x and 4.0.x. The
documentation has been clarified.

To do what you want, you should make sure your operation
implementations check how long they have been running for every so
often, and explicitly give up if they take too long.

Cheers,

Duncan.

-- 
 -- Duncan Grisby         --
  -- duncan@grisby.org     --
   -- http://www.grisby.org --