Freeswitch 在 centos 7.1 上启动时暂停 check_ip

Freeswitch pauses on check_ip at boot on centos 7.1

在调查另一个问题时 (Inconsistent systemd startup of freeswitch),我发现最新的 freeswitch 1.6 和 1.7 在 centos 7.1 上启动期间一次暂停几分钟(4 到 14 分钟之间)。虽然是断断续续的,但也有 3 或 4 次的频率。

运行 这来自命令行:

/usr/bin/freeswitch -nonat -db /dev/shm -log /usr/local/freeswitch/log -conf /usr/local/freeswitch/conf -run /usr/local/freeswitch/run

导致以下输出(注意添加任务 2 与其后一行之间的时间差):

2015-10-23 15:40:14.160101 [INFO] switch_event.c:685 Activate Eventing Engine.
2015-10-23 15:40:14.170805 [WARNING] switch_event.c:656 Create additional event dispatch thread 0
2015-10-23 15:40:14.272850 [INFO] switch_core_sqldb.c:3381 Opening DB
2015-10-23 15:40:14.282317 [INFO] switch_core_sqldb.c:1693 CORE Starting SQL thread.
2015-10-23 15:40:14.285266 [NOTICE] switch_scheduler.c:183 Starting task thread
2015-10-23 15:40:14.293743 [DEBUG] switch_scheduler.c:249 Added task 1 heartbeat (core) to run at 1445611214
2015-10-23 15:40:14.293837 [DEBUG] switch_scheduler.c:249 Added task 2 check_ip (core) to run at 1445611214
2015-10-23 15:49:47.883158 [NOTICE] switch_core.c:1386 Created ip list rfc6598.auto default (deny)

当我从 centos6.7 的 1.6 运行 使用与上面相同的命令行时,我得到了这个 - 注意延迟更合理的 14 秒:

2015-10-23 10:31:00.274533 [INFO] switch_event.c:685 Activate Eventing Engine.
2015-10-23 10:31:00.285807 [WARNING] switch_event.c:656 Create additional event dispatch thread 0
2015-10-23 10:31:00.434780 [INFO] switch_core_sqldb.c:3381 Opening DB
2015-10-23 10:31:00.465158 [INFO] switch_core_sqldb.c:1693 CORE Starting SQL thread.
2015-10-23 10:31:00.481306 [DEBUG] switch_scheduler.c:249 Added task 1 heartbeat (core) to run at 1445610660
2015-10-23 10:31:00.481446 [DEBUG] switch_scheduler.c:249 Added task 2 check_ip (core) to run at 1445610660
2015-10-23 10:31:00.481723 [NOTICE] switch_scheduler.c:183 Starting task thread
2015-10-23 10:31:14.286702 [NOTICE] switch_core.c:1386 Created ip list rfc6598.auto default (deny)

FS 1.7 也一样。

这严重表明 centos 7.1 和 FS 一起存在问题。任何人都可以帮助我进一步诊断或对此进行更多说明吗?

当我试图理解为什么 FS 在我认为它已经启动后几分钟不接受 cli 连接时(使用 systemd 服务中的 -nc),这一切都曝光了。

感谢 FS 用户列表和最终的 Anthony Minessale,问题与 RNG 熵有关。

这个解释很好 - https://www.digitalocean.com/community/tutorials/how-to-setup-additional-entropy-for-cloud-servers-using-haveged

以下是一些摘录:

There are two general random devices on Linux: /dev/random and /dev/urandom. The best randomness comes from /dev/random, since it's a blocking device, and will wait until sufficient entropy is available to continue providing output.

这里的关键是它是一个阻塞设备,因此任何等待来自 /dev/random 的随机数的程序都会暂停,直到有足够的熵可用于 "safe" 随机数。

这是一个无头服务器,因此 mouse/keyboard activity(以及许多其他)等常用的熵源不适用。因此延迟,

修复方法是:

Based on the HAVEGE principle, and previously based on its associated library, haveged allows generating randomness based on variations in code execution time on a processor......(google the rest!)

像这样安装:

yum install haveged

然后像这样启动它:

haveged -w 1024

确保它在重启时重新启动:

chkconfig haveged on

希望这对某人有所帮助。