简体   繁体   English

自由开关被阻止

[英]Freeswitch Blocked

FreeSwitch software working well in a few days (~3 - 5 days), then new incoming call requests are accepted since FreeSwitch is blocked !! FreeSwitch软件在几天之内(〜3-5天)运行良好,由于FreeSwitch被阻止,因此可以接受新的来电请求! 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. 我得到了FreeSwitch快照,并在GDB中对其进行了分析。

I have 601 therads & most of them are waiting 我有601位therads,其中大多数人正在等待

Thread 0x7f16bc55f700 (LWP 28544) pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185

When i apply "thread apply all bt" in gdb, I see most of the threads try to push events into queue (switch_queue_push ) 当我在gdb中应用“线程应用所有bt”时,我看到大多数线程都试图将事件推送到队列中(switch_queue_push)

Thread 600 (Thread 0x7f16bc55f700 (LWP 28544)):
#0 pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007f180cf9b87d in apr_thread_cond_wait (cond=<optimized out>, mutex=<optimized out>) at locks/unix/thread_cond.c:68
#2  0x00007f180cf92dd0 in apr_queue_push (queue=queue@entry=0x7f180db157a8, data=data@entry=0x7f16d3d5ec20) at misc/apr_queue.c:166
#3  0x00007f180cc958fb in switch_queue_push (queue=0x7f180db157a8, data=data@entry=0x7f16d3d5ec20) at src/switch_apr.c:1134
#4  0x00007f180cd17850 in switch_event_queue_dispatch_event (eventp=0x7f16bc55ec48) at src/switch_event.c:384
#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
#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
#7  0x00007f180ccc87d0 in switch_core_session_run (session=0x7f17e3e7fd28) at src/switch_core_state_machine.c:543
#8  0x00007f180ccc36de in switch_core_session_thread (thread=<optimized out>, obj=0x7f17e3e7fd28) at src/switch_core_session.c:1629
#9  0x00007f180ccbf47d in switch_core_session_thread_pool_worker (thread=0x7f17e3e9abb0, obj=0x80) at src/switch_core_session.c:1692
#10 0x00007f180cfa1910 in dummy_worker (opaque=0x7f17e3e9abb0) at threadproc/unix/thread.c:151
#11 0x00007f180c1e0064 in start_thread (arg=0x7f16bc55f700) at pthread_create.c:309
#12 0x00007f180b8b862d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Why i am gonna getting this state? 为什么我要进入这种状态? Any thoughts, tips, tricks would be much appreciated. 任何想法,技巧和窍门将不胜感激。 Regards, 问候,

I've deeply researched and found the my solution, 我已经深入研究并找到了解决方案,

You should understand " Event handler mechanism " of Freeswitch in order to solve this issue. 您应该了解Freeswitch的“ 事件处理程序机制 ”以解决此问题。 Because there are many producer threads that generate and put its event to this queue, however only one consumer thread exist in this mechanism. 因为有许多生产者线程会生成事件并将其事件放入此队列,但是此机制中仅存在一个使用者线程。 Consumer thread which is as known event handler delivers event to the all listeners such as modules that listen appropriate event. 消费者线程(称为事件处理程序)将事件传递给所有侦听器,例如侦听适当事件的模块。

One or more of these listeners could hold up (via blocking) this consumer thread, and event queue could becoming get a full. 这些监听器中的一个或多个可以阻止(通过阻止)此使用者线程,并且事件队列可能变得很满。 When event queue getting a full, your feeswitch will be blocked. 当事件队列已满时,您的费用切换将被阻止。

There are three solution for solving theses issue: 解决这些问题有三种解决方案:

1: In default configuration, event handler mechanism uses event queue. 1:在默认配置下,事件处理程序机制使用事件队列。 But, you can use thread solution for this with changing " events-use-dispatch=false " value in " post_load_switch.conf " file. 但是,您可以通过更改“ post_load_switch.conf ”文件中的“ events-use-dispatch = false ”值来使用线程解决方案。

2: Inscreasing consumer threads number , because single consumer thread is not good solution for heavy load freeswitch server you could do it with " initial-event-threads=X " in " post_load_switch.conf " file where X represent initial thread count. 2:增加使用者线程数,因为单个使用者线程不是重载freeswitch服务器的好解决方案,您可以使用“ post_load_switch.conf ”文件中的“ initial-event-threads = X ”来完成,其中X表示初始线程数。

3: In your module, you could use your event handler mechanism too. 3:在模块中,您也可以使用事件处理程序机制。 When you gets a event from core of Freeswitch, create a new thread and assign it into the your newly created thread in order to not waiting Freeswitch's consumer thread. 当您从Freeswitch的核心获取事件时,请创建一个新线程并将其分配到您新创建的线程中,以便不等待Freeswitch的使用者线程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM