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.
--- openfire.orig 2008-11-17 09:55:27.000000000 -0500 +++ openfire 2008-11-17 10:08:06.000000000 -0500 @@ -133,6 +133,9 @@ [ -f "$OPENFIRE_PIDFILE" ] && kill `cat $OPENFIRE_PIDFILE` RETVAL=$? + + # if it's not dead, kill it harder + ps --no-headers `cat $OPENFIRE_PIDFILE` > /dev/null && kill -9 `cat $OPENFIRE_PIDFILE` echo [ $RETVAL -eq 0 -a -f "$OPENFIRE_PIDFILE" ] && rm -f $OPENFIRE_PIDFILE
I hope this will be of some help to someone; there is no doubt a more elegant way to implement this check, but this has been working for me so far.
openfire_init.patch (408 Bytes)