Openfire on RHEL5 (32 and 64-bit) has problems with periodically running out of memory and hanging; I’ve seen these documented in forum threads and on the issue tracker. As a workaround, I’ve configured my monitoring system to automatically restart Openfire as an initial troubleshooting step when the service stops responding; unfortunately, when the java process hangs, it does not respond to SIGTERM. The init script doesn’t know this, since kill cat $OPENFIRE_PIDFILE`` returns successful even when the java process ignores the signal; I’ve written a little patch, included below, which adds another check to make sure the java process really died.
Thanks for posting and providing a patch I am a rhel5 user as well and have noticed this problem… One thing I worry about tho with this approach is ‘killing’ openfire too quickly before it can fully flush out its writes / whatever else it is trying to do during the shutdown path. Maybe it would be better to have a ‘hardstop’ service option that would do the -9 if necessary ? Then one could do
your patch looks ugly. Openfire may need some seconds to shutdown completely so you should wait at least 30 seconds for a clean shutdown before you kill the process.
I usually add a “kill” option to scripts when needed which send “-9” to the process while stop sends “-15”.
Thanks for the feedback! Below is a cleaned-up patch that’s a bit more careful about how it behaves. I decided not to add an extra “kill” argument to the script because it breaks the common Red Hat paradigm for services (i.e. service start|stop|restart|status); instead, I first try a clean shutdown, wait a little while, then check to see if the server is still hanging around, and only then try to kill it harder. -steve