[Freeswitch-users] question on media bugs: add / remove /add sequence leading to crash when session ends

Dragos Oancea dragos at freeswitch.org
Mon Sep 9 11:50:26 UTC 2019


It looks to me like it should have worked.

Maybe you do something wrong in the callback ?

Refer to other code that uses media bug, like mod_avmd .


On Fri, Sep 6, 2019 at 7:03 PM David Horton <daveh at drachtio.org> wrote:

> (Resending, as original email has not appeared in the mailing list)
>
> I’m trying to understand the semantics of removing and re-adding a media
> bug to a channel.
>
> My scenario is that I need to add a bug to a session, and after some
> period of processing audio then want to remove it.
> Based on other factors, some time later in the call, I may want to re-add
> it again.
>
> I am on Freeswitch v1.8.5
>
> How I am doing this now is:
>
> - switch_core_media_bug_add(session, “my-function”, NULL, callback, …)
>
> some time later
>
> - switch_core_media_bug_remove(session, &bug);
>
> some time later
>
> - switch_core_media_bug_add(session, “my-function”, NULL, callback, …)
>
> That all works fine, but when the session ends I get a segfault.  See the
> stack trace below.
>
> (Note: I also tried using ‘switch_core_media_bug_close’ for the second
> step, and I don’t get a stack trace in that scenario, but neither does my
> callback get invoked after I re-add the bug in step #3).
>
> So, two questions:
>
> 1) What is the recommended way to accomplish what I am doing?
> 2) Is this a bug in freeswitch that I should report via Confluence?
>
> Thread 40 "freeswitch" received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0x7fffee766700 (LWP 31704)]
> __GI___pthread_rwlock_unlock (rwlock=0x7fffc801acf0) at
> pthread_rwlock_unlock.c:38
> 38      pthread_rwlock_unlock.c: No such file or directory.
> (gdb) bt
> #0  __GI___pthread_rwlock_unlock (rwlock=0x7fffc801acf0) at
> pthread_rwlock_unlock.c:38
> #1  0x00007ffff7658b6e in apr_thread_rwlock_unlock () from
> /usr/local/freeswitch/lib/libfreeswitch.so.1
> #2  0x00007ffff6fc2cf3 in switch_thread_rwlock_unlock
> (rwlock=0x7fffc801ace8) at src/switch_apr.c:279
> #3  0x00007ffff6fe3272 in switch_core_media_bug_remove_all_function
> (session=0x7fffc801c158, function=0x0)
>    at src/switch_core_media_bug.c:1231
> #4  0x00007ffff700a6f3 in switch_core_session_hangup_state
> (session=0x7fffc801c158, force=SWITCH_TRUE)
>    at src/switch_core_state_machine.c:838
> #5  0x00007ffff7007178 in switch_core_session_run (session=0x7fffc801c158)
>    at src/switch_core_state_machine.c:615
> #6  0x00007ffff700069e in switch_core_session_thread
> (thread=0x7fffc8041410, obj=0x7fffc801c158)
>    at src/switch_core_session.c:1698
> #7  0x00007ffff7000a8d in switch_core_session_thread_pool_worker
> (thread=0x7fffc8041410, obj=0x7fffc80412a0)
>    at src/switch_core_session.c:1761
> #8  0x00007ffff7660e1f in dummy_worker () from
> /usr/local/freeswitch/lib/libfreeswitch.so.1
> #9  0x00007ffff63554a4 in start_thread (arg=0x7fffee766700) at
> pthread_create.c:456
> #10 0x00007ffff5992d0f in clone () at
> ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
> _________________________________________________________________________
>
> The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
> Enhance your FreeSWITCH install with disruptive priced SMS and PSTN
> services.
> Build your next product on our scalable cloud platform.
>
> Join our online community to chat in real time
> https://signalwire.community
>
> Professional FreeSWITCH Services
> sales at freeswitch.com
> https://freeswitch.com
>
> Official FreeSWITCH Sites
> https://freeswitch.com/oss
> https://freeswitch.org/confluence
> https://cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> https://freeswitch.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20190909/aed01ba8/attachment.html>


More information about the FreeSWITCH-users mailing list