From 7ffbe49712e8b12a69646d9ac98e07b156c4a64a Mon Sep 17 00:00:00 2001 From: Alex Kozyrev Date: Thu, 8 Aug 2019 15:26:08 -0400 Subject: [PATCH] Fix number of allowed missed messages from pmon in hostwd The following commit attempted to fix failure logic in hostwd: 4150f91ff0687268e094a58ab177a12d56e97114 hostwd_failure_threshold has been reduced from 5 to 3 in it, but the logic around pmon_grace_loops hasn't been touched. hostwd_failure_threshold is still reduced by 2 every time we miss a message from pmon. So, we only allow 1 missed message before the reboot. Removing this double substraction and reverting to old beavior: allow 2 missed messages from PMON and reboot a system on a 3rd one. Closes-Bug: 1824983 Change-Id: I57293f9383302d042faee78189409043e21b5801 Signed-off-by: Alex Kozyrev (cherry picked from commit 8f9decd6e53c1712084399350aefb2b50b9f5236) --- mtce/src/hostw/hostwHdlr.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/mtce/src/hostw/hostwHdlr.cpp b/mtce/src/hostw/hostwHdlr.cpp index e3af18e6..55931911 100644 --- a/mtce/src/hostw/hostwHdlr.cpp +++ b/mtce/src/hostw/hostwHdlr.cpp @@ -73,7 +73,7 @@ void hostw_service ( void ) hostw_ctrl_type *ctrl = get_ctrl_ptr (); daemon_config_type *config = daemon_get_cfg_ptr (); - ctrl->pmon_grace_loops = config->hostwd_failure_threshold + 1; + ctrl->pmon_grace_loops = config->hostwd_failure_threshold; socks.clear(); if ( hostw_socket->status_sock ) @@ -121,16 +121,10 @@ void hostw_service ( void ) { ctrl->pmon_grace_loops--; - /* we missed a message from PMON */ - if ( ctrl->pmon_grace_loops == (config->hostwd_failure_threshold - 1) ) - { - ilog ("Did not receive expected message from PMON - first missed message\n"); - } - ctrl->pmon_grace_loops--; if ( ctrl->pmon_grace_loops ) { ilog ("Did not receive expected message from PMON - %d more missed messages allowed\n", - ctrl->pmon_grace_loops); + ctrl->pmon_grace_loops-1); } } }