Perl SIGHUP handling and config reloading
authorBill Erickson <berick@esilibrary.com>
Mon, 15 Oct 2012 21:23:19 +0000 (17:23 -0400)
committerBill Erickson <berick@esilibrary.com>
Tue, 16 Oct 2012 13:15:06 +0000 (09:15 -0400)
commitfb2ca0f400989374ccce410d8b5d3e1b75c3ed6e
treef8799e7fb7173ae8184197dcbf3de3cef6c82fd7
parent56e5f5d796bcbf80bd8e801d523fc9e2aee3947d
Perl SIGHUP handling and config reloading

Sending the HUP signal to a Perl Listener process now results in the
following:

 * Reload the opensrf_core config
 * re-init the logger
 * kill idle child processes
 * child processes that are active when the signal is received are
   tracked and killed once they become idle.
 * New children are spawned per the min child settings

The primary use case for these changes is temporarily changing the log
level (or log file) for a given service for debug purposes.  It may also
be used, for example, to gracefully recover excess RAM consumed by a
child process.

Not all values in opensrf_core.xml are affected by a SIGHUP.  Since the
goal is a gracful reload, no attempt is made by the listener process to
re-connect to jabber or re-register with the opensrf router(s).  Child
processes will by necessity connect to Jabber during startup, though, so
any changes to the jabber configuration will affect child processes.  In
general, it's best to affect jabber configuration changes with a true
service restart.

opensrf.xml (opensrf.settings config) is not reloaded, so min/max child
settings will not be affected.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
src/perl/lib/OpenSRF/Server.pm
src/perl/lib/OpenSRF/Utils/Logger.pm