<div dir="ltr"><div dir="ltr"><div>Hi,</div><div><br></div>After deeply research about this issue, we understand <b>Freeswitch-Core</b> mechanism and three possible solutions for fixing these issue.<div><br></div><div>Here the link</div><div><a href="https://stackoverflow.com/questions/53609817/freeswitch-blocked">https://stackoverflow.com/questions/53609817/freeswitch-blocked</a> </div><div><br></div><div>Actually it would be be better third solution supported by <b>Freeswitch</b>, before deliver event to module, it create new thread for not waiting consumer thread (event hendler)</div></div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Dec 22, 2017 at 8:35 AM Melek Oktay <<a href="mailto:melekoktay@gmail.com">melekoktay@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div>Hi,</div><div><br></div><div>FreeSwitch software working well in a few days (~3 - 5 days), then new incoming call requests are accepted since FreeSwitch is blocked !! Ongoing calls continue their session, their calls seems not effected, but new calls are not accepted. I got FreeSwitch snapshot and analyzed it in GDB.</div><div><br></div><div>I have 601 therads & most of them are waiting </div><div><br></div><div><font face="monospace, monospace">Thread 0x7f16bc55f700 (LWP 28544) pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185</font><br></div><div><br></div><div>When i apply "<b>thread apply all bt</b>" in gdb, I see most of the threads try to push events into queue (<b style="font-family:monospace,monospace">switch_queue_push </b>)</div><div><br></div><div><div><font face="monospace, monospace">Thread 600 (Thread 0x7f16bc55f700 (LWP 28544)):</font></div><div><font face="monospace, monospace">#0 pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185</font></div><div><font face="monospace, monospace">#1 0x00007f180cf9b87d in apr_thread_cond_wait (cond=<optimized out>, mutex=<optimized out>) at locks/unix/thread_cond.c:68</font></div><div><font face="monospace, monospace">#2 0x00007f180cf92dd0 in apr_queue_push (queue=queue@entry=0x7f180db157a8, data=data@entry=0x7f16d3d5ec20) at misc/apr_queue.c:166</font></div><div><font face="monospace, monospace">#3 0x00007f180cc958fb in <b>switch_queue_push </b>(queue=<font color="#0000ff"><b>0x7f180db157a8</b></font>, data=data@entry=<b><font color="#ff0000">0x7f16d3d5ec20</font></b>) at src/switch_apr.c:1134</font></div><div><font face="monospace, monospace">#4 0x00007f180cd17850 in switch_event_queue_dispatch_event (eventp=0x7f16bc55ec48) at src/switch_event.c:384</font></div><div><font face="monospace, monospace">#5 switch_event_fire_detailed (file=file@entry=0x7f180cfb07ea "src/switch_channel.c", func=func@entry=0x7f180cfb2ba0 <__func__.18348> "switch_channel_perform_set_running_state", line=line@entry=2260, event=event@entry=0x7f16bc55ec48, user_data=user_data@entry=0x0) at src/switch_event.c:1986</font></div><div><font face="monospace, monospace">#6 0x00007f180cc9f118 in switch_channel_perform_set_running_state (channel=0x7f17e3e7de00, state=CS_NEW, file=0x7f180cfbc590 "src/switch_core_state_machine.c", func=<optimized out>, line=543) at src/switch_channel.c:2260</font></div><div><font face="monospace, monospace">#7 0x00007f180ccc87d0 in switch_core_session_run (session=0x7f17e3e7fd28) at src/switch_core_state_machine.c:543</font></div><div><font face="monospace, monospace">#8 0x00007f180ccc36de in switch_core_session_thread (thread=<optimized out>, obj=0x7f17e3e7fd28) at src/switch_core_session.c:1629</font></div><div><font face="monospace, monospace">#9 0x00007f180ccbf47d in switch_core_session_thread_pool_worker (thread=0x7f17e3e9abb0, obj=0x80) at src/switch_core_session.c:1692</font></div><div><font face="monospace, monospace">#10 0x00007f180cfa1910 in dummy_worker (opaque=0x7f17e3e9abb0) at threadproc/unix/thread.c:151</font></div><div><font face="monospace, monospace">#11 0x00007f180c1e0064 in start_thread (arg=0x7f16bc55f700) at pthread_create.c:309</font></div><div><font face="monospace, monospace">#12 0x00007f180b8b862d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111</font></div></div><div><br></div><div><br></div><div>More interesting thing is below, when I look up event type, approximately all of them are "<span style="font-family:monospace,monospace">SWITCH_EVENT_CHANNEL_STAT</span><font face="arial, helvetica, sans-serif">E" and switch_queue (i think sofia_module queue is used in this scenario ) <b>become full</b> !!! <b>nelts</b> (number of elements ) and <b>bounds </b>values are equal, and there are 553 (full_waiters) waiters try to push , but no body try to consume it (empty_waiters = 0)</font></div><div><font face="monospace, monospace"><br></font></div><div><div><font face="monospace, monospace">(gdb) print *(switch_queue_t *) <font color="#0000ff"><b>0x7f180db157a8</b></font></font></div><div><font face="monospace, monospace">$1 = {</font></div><div><font face="monospace, monospace"> data = 0x7f1805cfe038,</font></div><div><font face="monospace, monospace"> nelts = 50000,</font></div><div><font face="monospace, monospace"> in = 43000,</font></div><div><font face="monospace, monospace"> out = 43000,</font></div><div><font face="monospace, monospace"> bounds = 50000,</font></div><div><font face="monospace, monospace"> full_waiters = 553,</font></div><div><font face="monospace, monospace"> empty_waiters = 0,</font></div><div><font face="monospace, monospace"> one_big_mutex = 0x7f180db157e8,</font></div><div><font face="monospace, monospace"> not_empty = 0x7f180db15838,</font></div><div><font face="monospace, monospace"> not_full = 0x7f180db15890,</font></div><div><font face="monospace, monospace"> terminated = 0</font></div><div><font face="monospace, monospace">}</font></div></div><div><font face="monospace, monospace"><br></font></div><div><div><font face="monospace, monospace">(gdb) print *(switch_event_t *) <b><font color="#ff0000">0x7f16d3d5ec20</font></b></font></div><div><font face="monospace, monospace">$1 = {</font></div><div><font face="monospace, monospace"> event_id = SWITCH_EVENT_CHANNEL_STATE,</font></div><div><font face="monospace, monospace"> priority = SWITCH_PRIORITY_NORMAL,</font></div><div><font face="monospace, monospace"> owner = 0x0,</font></div><div><font face="monospace, monospace"> subclass_name = 0x0,</font></div><div><font face="monospace, monospace"> headers = 0x7f16d3d5f750,</font></div><div><font face="monospace, monospace"> last_header = 0x7f16d3d601d0,</font></div><div><font face="monospace, monospace"> body = 0x0,</font></div><div><font face="monospace, monospace"> bind_user_data = 0x0,</font></div><div><font face="monospace, monospace"> event_user_data = 0x0,</font></div><div><font face="monospace, monospace"> key = 0,</font></div><div><font face="monospace, monospace"> next = 0x0,</font></div><div><font face="monospace, monospace"> flags = 0</font></div><div><font face="monospace, monospace">}</font></div></div><div><br></div><div><br></div><div>Why i am gonna getting this state? </div><div><pre style="white-space:pre-wrap"><font face="arial, helvetica, sans-serif">Any thoughts, tips, tricks would be much appreciated.<br></font></pre><pre style="white-space:pre-wrap"><font face="arial, helvetica, sans-serif">Regards,</font></pre><pre style="white-space:pre-wrap"><font face="arial, helvetica, sans-serif">Angel</font></pre></div></div>
</blockquote></div>