<html><body><div style="color:#000; background-color:#fff; font-family:verdana, helvetica, sans-serif;font-size:13px"><div id="yiv4802513029"><div id="yui_3_16_0_1_1431495635067_15194"><div style="color:#000;background-color:#fff;font-family:verdana, helvetica, sans-serif;font-size:13px;" id="yui_3_16_0_1_1431495635067_15193"><div id="yiv4802513029yui_3_16_0_1_1431495635067_2457" class="yiv4802513029" style="font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:10px;"><font id="yiv4802513029yui_3_16_0_1_1431495635067_2729" face="verdana, helvetica, sans-serif" size="2" class="yiv4802513029" style="">Dear Dev-team,</font></div><div id="yiv4802513029yui_3_16_0_1_1431495635067_2457" class="yiv4802513029" dir="ltr" style="font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:10px;"><font id="yiv4802513029yui_3_16_0_1_1431495635067_2728" face="verdana, helvetica, sans-serif" size="2" class="yiv4802513029" style="">I'm so happy with how FreeSWITCH is built and thanks for such an awesome project. I'm in the process of building an FS module and I'm trying to understand how to avoid a potential thread synchronization issue(due to my logic). I have a global hash table that encapsulates business logic(lots of business data about caller and callee.) Leg A's UUID will be used as a key in the hash table that holds data fetched from database. Once the call is disconnected, a cleanup will take place during reporting state handler callback on Leg A which I'm thinking it will be called after hangup state. Now, if Leg B happens to take long time to process its database logic, Leg A might be gone before leg B is finished and at this point Leg B will segfault because the data it needs from the hash table are cleaned by Leg A reporting/hangup state handler. </font></div><div id="yiv4802513029yui_3_16_0_1_1431495635067_2457" class="yiv4802513029" style="font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:10px;"><font face="verdana, helvetica, sans-serif" size="2" class="yiv4802513029" style=""><br class="yiv4802513029" style=""></font></div><div id="yiv4802513029yui_3_16_0_1_1431495635067_2457" class="yiv4802513029" style="font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:10px;"><font face="verdana, helvetica, sans-serif" size="2" id="yiv4802513029yui_3_16_0_1_1431495635067_2807" class="yiv4802513029" style="">Cloning the data structure on both channels will fix this issue but will not be efficient, in addition having a mutex lock may not work because a thread might die holding a lock and this might be a potential FS core segfault. </font></div><div id="yiv4802513029yui_3_16_0_1_1431495635067_2457" dir="ltr" class="yiv4802513029" style="font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:10px;"><font id="yiv4802513029yui_3_16_0_1_1431495635067_2727" face="verdana, helvetica, sans-serif" size="2" class="yiv4802513029" style="">Any suggestion is very much appreciated. </font></div><div id="yiv4802513029yui_3_16_0_1_1431495635067_2457" dir="ltr" class="yiv4802513029" style="font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:10px;"><font face="verdana, helvetica, sans-serif" size="2" class="yiv4802513029" style=""><br class="yiv4802513029" style=""></font></div><div id="yiv4802513029yui_3_16_0_1_1431495635067_2457" dir="ltr" class="yiv4802513029" style="font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:10px;"><font face="verdana, helvetica, sans-serif" size="2" id="yiv4802513029yui_3_16_0_1_1431495635067_10535" class="yiv4802513029" style="">Best Regards,</font></div><div id="yiv4802513029yui_3_16_0_1_1431495635067_2457" dir="ltr" class="yiv4802513029" style="font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:10px;"><font face="verdana, helvetica, sans-serif" size="2" id="yiv4802513029yui_3_16_0_1_1431495635067_10536" class="yiv4802513029" style="">Dave</font></div><div class="yiv4802513029" style="" id="yui_3_16_0_1_1431495635067_15288"><br class="yiv4802513029" style=""></div></div></div></div></div></body></html>