naemon / naemon-core

Networks, Applications and Event Monitor
http://www.naemon.io/
GNU General Public License v2.0
153 stars 63 forks source link

HUP signal cause livestatus initialisation errors with TCP config #359

Open snarf6 opened 3 years ago

snarf6 commented 3 years ago

Hi,

When using a HUP signal to reload naemon config, naemon complains about port binding

naemon                | Caught 'Hangup', restarting...
naemon                | Retention data successfully saved.
naemon                | Event broker module 'NERD' deinitialized successfully.
naemon                | livestatus: deinitializing
naemon                | livestatus: Logfile cache: flushing complete cache.
naemon                | Event broker module '/usr/lib/naemon/naemon-livestatus/livestatus.so' deinitialized successfully.
naemon                | Event broker module '/usr/lib/x86_64-linux-gnu/mod_gearman/mod_gearman_naemon.o' deinitialized successfully.
naemon                | Naemon 1.2.4 starting... (PID=14)
naemon                | Local time is Mon Apr 12 13:20:41 UTC 2021
naemon                | qh: Socket '/var/lib/naemon/naemon.qh' successfully initialized
naemon                | nerd: Channel hostchecks registered successfully
naemon                | nerd: Channel servicechecks registered successfully
naemon                | nerd: Fully initialized and ready to rock!
naemon                | livestatus: Naemon Livestatus 1.2.4.1.source, TCP: '0.0.0.0:6557'
naemon                | livestatus: Unable to bind to '0.0.0.0:6557'
naemon                | Error: Function nebmodule_init() in module '/usr/lib/naemon/naemon-livestatus/livestatus.so' returned an error.  Module will be unloaded.
naemon                | Event broker module '/usr/lib/naemon/naemon-livestatus/livestatus.so' deinitialized successfully.
naemon                | Error: Failed to load module '/usr/lib/naemon/naemon-livestatus/livestatus.so'.
naemon                | mod_gearman: initialized version 3.3.4.20210311 (libgearman 0.33)
naemon                | Event broker module '/usr/lib/x86_64-linux-gnu/mod_gearman/mod_gearman_naemon.o' initialized successfully.
naemon                | Error: Module loading failed. Aborting.
naemon                | Event broker module 'NERD' deinitialized successfully.
naemon                | Event broker module '/usr/lib/x86_64-linux-gnu/mod_gearman/mod_gearman_naemon.o' deinitialized successfully.

Btw, the tcp port still works well. and the port is still binded. I think that the HUP make unload/load to fast.

This was tested in docker only atm

Naemon version :

ii  libnaemon                   1.2.4.g6d3ec340.20210313      amd64        Library for Naemon - common data files
ii  naemon-core                 1.2.4.g6d3ec340.20210313      amd64        host/service/network monitoring and management system
ii  naemon-livestatus           1.2.4.1                       amd64        contains the Naemon livestatus eventbroker module

I hope that could help ;)

Thx

snarf6 commented 3 years ago

One more point, this behavior seems to appear when the HUP is send when there is no changement in configuration