Linux – Is it safe to stop a Jboss EAP server with Kill -9

jbosskilllinux

We are having an internal debate about this. Running jboss eap 7 on RHEL.
We currently have a script to stop the server by simply running kill -9 on the java process.

My suggestion was to use the proper jboss command to shut down:

jboss-cli --connect --commands=:shutdown

How are we ensured that jboss gracefully closed from a kill? I am pushing to use the jboss command.

Best Answer

If the software is non-trivial and comes with a documented means of shutting it down, as appears to be the case here, go with whatever that is. (There may be multiple options.)

Regarding SIGKILL (signal 9) specifically, there's nothing graceful about it.
The target process cannot intercept and handle this signal; it's just immediately terminated without getting to finish up what it was doing or do any cleanup that it would normally do before shutting down.

As for signals in general, if the goal is some form of graceful shutdown look into how the software handles SIGTERM and/or SIGINT. Software at least has the possibility of taking these into account and gracefully shutting down.

SIGKILL should be considered a last resort when gracefully shutting down the service does not work.

Related Topic