MysteriousShutdowns

Mysterious JBoss Shutdowns

 

Many users have said that they experience mysterious JBoss Shutdowns.  Here are some troubleshooting tips to find out where they are comming from.

 

 

Look at the logs

The logs can tell you alot of information about shutdowns.  The shutdown Logs wiki shows you what the log files look like for different scenarios.

 

What can it be

Most shut downs are due to occurrences, such as users logging off while running jboss, someone accidentally hitting ctrl-c, or other simple answers, but sometimes it is due to inadvertent signals sent to the jvm that causes it to shut down.

 

Running JBoss as a Service?

Some users have reported JBoss experiencing clean shutdowns while running as a service. It turns out that the Sun JVM monitors for SIGHUP and interprets it as a signal to shut down, so this can occur anytime the console user logs out of the system. So if you are running JBoss as a service and you get mysterious shutdowns, it probably is an OS signal.  The solution is to add -Xrs as a jvm parameter as explained below.  You may want to visit Running JBoss as a Windows Service for more information.

 

Signals coming from the Operating system

If you have ruled everything else out, it probably is an errant signal coming from the OS.

 

Solution 1 - Use of Xrs to reduce signals to the JVM

-Xrs Reduces use of operating-system signals by the Java virtual machine (JVM). This option is available beginning with J2SE 1.3.1. In J2SE 1.3.0, the Shutdown Hooks facility was added to allow orderly shutdown of a Java application. The intent was to allow user cleanup code (such as closing database connections) to run at shutdown, even if the JVM terminates abruptly. You can reference the following url, that gives you a table of the operating systems and the associated interrupts that Xrs will stop the vm from listening to. Revelations on Java signal handling

 

Sun's JVM catches signals to implement shutdown hooks for abnormal JVM termination. The JVM uses SIGHUP, SIGINT, and SIGTERM to initiate the running of shutdown hooks.

 

The JVM uses a similar mechanism to implement the pre-1.2 feature of dumping thread stacks for debugging purposes. Sun's JVM uses SIGQUIT to perform thread dumps.

 

Applications embedding the JVM frequently need to trap signals like SIGINT or SIGTERM, which can lead to interference with the JVM's own signal handlers. To address this issue, the -Xrs command-line option has been added beginning in J2SE 1.3.1. When -Xrs is used on Sun's JVM, the signal masks for SIGINT, SIGTERM, SIGHUP, and SIGQUIT are not changed by the JVM, and signal handlers for these signals are not installed.

 

Solution 2 - Use of a utility to intercept signals

Use a utility that will intercept all of the Signals, log them and drop them.  Attached to this wiki is an experimental project that produces a sar that will do this.  Please keep in mind that after deploying this, the only way to shut JBoss down is through JMX.  You must have JMX enabled or you will not be able to shut the instance down.