[Freeswitch-dev] Avoid Segfault
Dave Greeko
davegreeko at yahoo.com
Wed May 13 10:04:34 MSD 2015
Dear Dev-team,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.
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. Any suggestion is very much appreciated.
Best Regards,Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20150513/d07f7431/attachment-0001.html
Join us at ClueCon 2014 Aug 4-7, 2014
More information about the FreeSWITCH-dev
mailing list