]> git.proxmox.com Git - pve-ha-manager.git/commit
explicitly sync journal when disabling watchdog updates
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 23 May 2017 12:35:38 +0000 (14:35 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 14 Jun 2017 05:47:54 +0000 (07:47 +0200)
commit9f4494639d847bf4e022e6faa1462d61114afaa4
tree688ed91c0f570831457a77dfc626a0064393ea97
parentf65f41b9d8fcdb1517f2089c9f1b5abb4fbaedc7
explicitly sync journal when disabling watchdog updates

Without syncing the journal could loose logs for a small interval (ca
10-60 seconds), but these last seconds are really interesting for
analyzing the cause of a triggered watchdog.

Also without this often the
> "client did not stop watchdog - disable watchdog updates"
messages wasn't flushed to persistent storage and so some users had a
hard time to figure out why the machine reset.

Use the '--sync' switch of journalctl which - to quote its man page -
"guarantees that any log messages written before its invocation are
safely stored on disk at the time it returns."

Use execl to call `journalctl --sync` in a child process, do not care
for any error checks or recovery as we will be reset anyway. This is
just a hit or miss try to log the situation more consistently, if it
fails we cannot really do anything anyhow.

We call the function on two points:
a) if we exit with active connections, here the watchdog will be
   triggered soon and we want to ensure that this is logged.
b) if a client closes the connection without sending the magic close
   byte, here the watchdog would trigger while we hang in epoll at
   the beginning of the loop, so sync the log here also.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/watchdog-mux.c