[omniORB] Proper way for orderly server process shutdown?

Wil_Evers@doosys.com Wil_Evers@doosys.com
Thu, 08 Jul 1999 15:30:02 GMT


Hi,

I'm having trouble understanding how to properly shut down an omniORB
server process.  I've stripped my code down to a server process with a
single root servant object in it, which has a method called shutdown().  I
tried the following scenarios:

- Define shutdown() as oneway, and have it call impl_shutdown() on the BOA.
- Define shutdown() as a regular method calling _dispose() on the root
object. This eventually leads to a call to the root object's destructor,
which then calls impl_shutdown() on the BOA.
- Alternatively, I tried using the non-blocking option in the BOA's
impl_is_ready() method, and have the main thread wait on a semaphore, which
is either signalled from the root object's shutdown() method or from its
destructor.

In all cases, the results are unpredictable.  Most times the server just
hangs in impl_shutdown(), sometimes I get a core dump, and sometimes things
appear to work for a short while.  Obviously, there's some sort of race
condition, as the last method works if I have the main thread sleep for
some seconds before calling impl_shutdown() and exiting.

Does anyone have some simple example code performing an orderly shutdown?
Platform details: I'm running Linux kernel 2.0.36 with glibc2 and
egcs-1.1.2.

Thanks,

- Wil

Wil Evers, DOOSYS IT Consultants, Maarssen, Holland
(Wil_Evers@doosys.com)