Skip to main content

Problem:

  • Product Name: VisiBroker for C
  • Product Version:7.0
  • Product Component: ORB
  • Platform/OS Version: Unix, Linux

When a SIGTERM signal is sent, the Server catches it, but nothing happened. Below is the code snippet for the handler;

 ...
 cout << "signal catch ";
 switch (sigNo) {

 case SIGTERM:
 cout << "SIGTERM" << endl;
 orb->shutdown(NULL);
 exit(0);
 ...


When SIGTERM is received, it displayed

 "signal catch SIGTERM"

message. However, the orb is not shutdown.

Resolution:

The orb registered the SIGTERM signal handler to block on a signal thread to have a dedicated thread to handle signals, if not, the signals sometimes get randomly delivered to other threads. It also registered itself in the atexit() handler to perform shutdown when the main() thread is returning back to the system.

If the user signal handler is also handling the signal and calling shutdown(), and when exit(0) is executed, another orb shutdown() thread is also called. These would cause the threads to block. Therefore, at any one time, shutdown() should be called once. Changing to "_exit(0)" will prevent the atexit handler from calling the shutdown again.


#Security
#signalhandler
#VisiBroker