- Standby amfd may miss node delete apply callback by somehow.
Then it will crash when handling event in failover state due to:
Assertion 'avnd->list_of_ncs_su.empty() != true' failed
in function avd_node_down_mw_susi_failover().
---
 src/amf/amfd/ndproc.cc |  6 ++++++
 src/amf/amfd/node.cc   | 18 ++++++++++++++----
 src/amf/amfd/node.h    |  1 +
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/src/amf/amfd/ndproc.cc b/src/amf/amfd/ndproc.cc
index 853a68b..828600a 100644
--- a/src/amf/amfd/ndproc.cc
+++ b/src/amf/amfd/ndproc.cc
@@ -37,6 +37,7 @@
 #include "amf/amfd/amfd.h"
 #include "amf/amfd/imm.h"
 #include "amf/amfd/cluster.h"
+#include "amf/amfd/node.h"
 
 /**
  * This function does a sanity check w.r.t the message received and returns the
@@ -1233,6 +1234,11 @@ done:
  */
 void avd_node_failover(AVD_AVND *node, const bool mw_only) {
   TRACE_ENTER2("'%s'", node->name.c_str());
+
+  if (avd_cleanup_node(node) == true) {
+    TRACE_LEAVE();
+    return;
+  }
   if (mw_only == true) {
     avd_node_down_mw_susi_failover(avd_cb, node);
   } else {
diff --git a/src/amf/amfd/node.cc b/src/amf/amfd/node.cc
index e8f32bb..e28c25c 100644
--- a/src/amf/amfd/node.cc
+++ b/src/amf/amfd/node.cc
@@ -1652,11 +1652,21 @@ void avd_check_nodes_after_reinit_imm() {
   AmfDb<std::string, AVD_AVND>::iterator it;
   for (it = node_name_db->begin(); it != node_name_db->end(); it++)
   {
-    if (object_exist_in_imm(it->first) == false) {
-      LOG_WA("Remove node %s after reinit IMM", it->first.c_str());
-      node_ccb_apply_delete_hdlr(it->second);
-    }
+    avd_cleanup_node(it->second);
   }
 
   TRACE_LEAVE();
 }
+
+bool avd_cleanup_node(AVD_AVND *node)
+{
+  TRACE_ENTER();
+  if (object_exist_in_imm(node->name) == false) {
+    LOG_WA("Remove node %s not exist in IMM", node->name.c_str());
+    node_ccb_apply_delete_hdlr(node);
+    TRACE_LEAVE();
+    return true;
+  }
+  TRACE_LEAVE();
+  return false;
+}
\ No newline at end of file
diff --git a/src/amf/amfd/node.h b/src/amf/amfd/node.h
index 388a8bf..d966d7e 100644
--- a/src/amf/amfd/node.h
+++ b/src/amf/amfd/node.h
@@ -241,5 +241,6 @@ extern bool any_ng_in_locked_in_state(const AVD_AVND *node);
 void avd_ng_restore_headless_states(AVD_CL_CB *cb,
                                     struct avd_su_si_rel_tag *susi);
 void avd_check_nodes_after_reinit_imm();
+bool avd_cleanup_node(AVD_AVND *node);
 
 #endif  // AMF_AMFD_NODE_H_
-- 
2.7.4



_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to