Hi Minh,
I guess this is happening in a very thin time window. When avd_imm_reinit_bg() 
spawns thread and comes out (thread has still not started finalization of 
handle). Now poll gets unblocked in main thread for imm event. So there will be 
race where thread will be finalizing the handle and Dispatch() also tries to 
use it.

I thinnk one solution is what you have suggest above. Other could be:
diff --git a/osaf/services/saf/amf/amfd/imm.cc 
b/osaf/services/saf/amf/amfd/imm.cc
--- a/osaf/services/saf/amf/amfd/imm.cc
+++ b/osaf/services/saf/amf/amfd/imm.cc
@@ -1969,7 +1969,7 @@ void avd_imm_reinit_bg(void)
                return;
        }
        avd_cb->avd_imm_status = AVD_IMM_INIT_ONGOING;
-
+       avd_cb->imm_sel_obj = -1;
        LOG_NO("Re-initializing with IMM");

        osaf_mutex_lock_ordie(&imm_reinit_thread_startup_mutex);
      
 We can use both also. Please share the traces if possbile. Based on that we 
can decide.
 
Thanks,
Praveen


---

** [tickets:#2188] amfd: avd_imm_impl_set fails causing node reboot**

**Status:** fixed
**Milestone:** 5.0.2
**Created:** Tue Nov 15, 2016 06:39 AM UTC by Gary Lee
**Last Updated:** Mon Nov 28, 2016 02:33 AM UTC
**Owner:** Praveen
**Attachments:**

- 
[amfd-core.txt](https://sourceforge.net/p/opensaf/tickets/2188/attachment/amfd-core.txt)
 (9.9 kB; text/plain)


avd_imm_impl_set fails causing node reboot

It seems there may have been simultaneous IMM reinit threads running.

Nov 14 02:24:26 SC-2-2 osafamfd[4174]: NO Re-initializing with IMM
Nov 14 02:24:26 SC-2-2 osafamfd[4174]: NO Re-initializing with IMM
Nov 14 02:24:26 SC-2-2 osafimmnd[16412]: NO Implementer connected: 44 
(safAmfService) <526, 2020f>
Nov 14 02:24:26 SC-2-2 osafamfd[4174]: NO Finished re-initializing with IMM
Nov 14 02:24:26 SC-2-2 osafamfd[4174]: ER saImmOiImplementerSet failed 14
Nov 14 02:24:26 SC-2-2 osafamfd[4174]: ER exiting since avd_imm_impl_set failed
Nov 14 02:24:26 SC-2-2 osafimmnd[16412]: NO Implementer locally disconnected. 
Marking it as doomed 44 <526, 2020f> (safAmfService)
Nov 14 02:24:26 SC-2-2 osafamfnd[4192]: WA AMF director unexpectedly crashed
Nov 14 02:24:26 SC-2-2 osafamfnd[4192]: Rebooting OpenSAF NodeId = 131599 EE 
Name = , Reason: local AVD down(Adest) or both AVD down(Vdest) received, 
OwnNodeId = 131599, SupervisionTime = 60
Nov 14 02:24:26 SC-2-2 osafimmnd[16412]: NO Implementer disconnected 44 <526, 
2020f> (safAmfService)


---

Sent from sourceforge.net because [email protected] is 
subscribed to https://sourceforge.net/p/opensaf/tickets/

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/opensaf/admin/tickets/options.  Or, if this is a 
mailing list, you can unsubscribe from the mailing list.
------------------------------------------------------------------------------
_______________________________________________
Opensaf-tickets mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-tickets

Reply via email to