[Freeswitch-dev] Avoid Segfault
Anthony Minessale
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
> segfault.
> Any suggestion is very much appreciated.
>
> Best Regards,
> Dave
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-dev mailing list
> FreeSWITCH-dev at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org
>
>
--
Anthony Minessale II ♬ @anthmfs ♬ @FreeSWITCH ♬
☞ http://freeswitch.org/ ☞ http://cluecon.com/ ☞
http://twitter.com/FreeSWITCH
☞ irc.freenode.net #freeswitch ☞ *http://freeswitch.org/g+
<http://freeswitch.org/g+>*
ClueCon Weekly Development Call
☎ sip:888 at conference.freeswitch.org ☎ +19193869900
https://www.youtube.com/watch?v=9XXgW34t40s
https://www.youtube.com/watch?v=NLaDpGQuZDA
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20150630/ee316372/attachment-0001.html
Join us at ClueCon 2014 Aug 4-7, 2014
More information about the FreeSWITCH-dev
mailing list