[Freeswitch-dev] Avoid Segfault
anthony.minessale at gmail.com
Wed Jul 1 00:59:27 MSD 2015
Threads don't die. You can have a global mutex in the module that protects
access to the hash table (this is mandatory on hash tables shared by
threads in FS)
You should lock the mutex just when you are accessing the hash.
p.s. your email is tagged as suspicious so I never saw this email until I
glanced in my spam folder. You may want to review your settings.
On Wed, May 13, 2015 at 12:59 AM, Dave Greeko <davegreeko at yahoo.com> wrote:
> 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
> Any suggestion is very much appreciated.
> Best Regards,
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> Official FreeSWITCH Sites
> FreeSWITCH-dev mailing list
> FreeSWITCH-dev at lists.freeswitch.org
Anthony Minessale II ♬ @anthmfs ♬ @FreeSWITCH ♬
☞ http://freeswitch.org/ ☞ http://cluecon.com/ ☞
☞ irc.freenode.net #freeswitch ☞ *http://freeswitch.org/g+
ClueCon Weekly Development Call
☎ sip:888 at conference.freeswitch.org ☎ +19193869900
-------------- next part --------------
An HTML attachment was scrubbed...
Join us at ClueCon 2014 Aug 4-7, 2014
More information about the FreeSWITCH-dev