[omniORB] Problem shuting down server on Aix 4.3.2

Duncan Grisby duncan@grisby.org
Fri Aug 2 12:48:01 2002


On Tuesday 30 July, "Thomas Zumbiehl" wrote:

> I have a soft made using 3 tiers architecture. One client, one main server
> and one slave server. I am trying to make the slave server having a smooth
> shutdown. I am doing this by catching the USR1, USR2 and TERM signals. When
> I get one of those, I do an orb shutdown (that was my first attempt). This
> works fine on Linux 2.2 and Solaris 7. But it does'nt work on Aix (I get an
> abort after the orb has been shut down).
> I tried the solution of a "shutdown thread" waiting on a semaphore. I did'nt
> get any better result.

You can't call shutdown from inside a signal handler. You've just been
luck so far if it hasn't blown up on Linux and Solaris. When you say
you've tried with a thread waiting on a semaphore, do you mean a Posix
semaphore?  An omni_semaphore won't do. The only primitive that is
guaranteed signal-safe is the Posix semaphore (and even then it isn't
always). Have you got any AIX documentation to say what's signal safe
and what isn't?

As a real hack, if you don't need to shut down immediately you get a
signal, just quite soon, you could use a global flag to indicate that
you should shut down. Then you have a thread that wakes up every
second or so and checks the flag. I suppose that could still cause
problems on a multi-processor machine if the shutdown thread spotted
the flag changing while the signal handler was still running, but it
would probably be OK.

As a final suggestion, can you use a CORBA call to kill the slave
server, rather than giving it a signal?

Cheers,

Duncan.

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