Having recently encountered an unusual/annoying problem with my new install, I hereby document my travails to aid those who come after.
TL;DR Rename away /usr/sbin/safe_asterisk
, copy /contrib/systemd/asterisk.service
to /etc/systemd/system/
. systemctl daemon-reload
, systemctl restart asterisk
.
CentOS 7, Asterisk 20.0 built from source
I downloaded and installed Asterisk 20, following a procedure that had been successfully tested with v18 on a CentOS VM, and was adapted from Asterisk: The Definitive Guide. Asterisk started up, and all seemed fine until I happened to top. One core was pegged at 100%.
Symptoms
After starting with systemctl start asterisk
, Asterisk would idle with one core at 100% - not constantly, because it would occasionally (between 10 and 70 seconds) switch to another core. Otherwise performance was normal (at least under light testing).
The game is afoot!
I tried with a minimal modules.conf - no change. I tried with empty dialplan - no change.
Was it SELinux? I tried both setenforce permissive
and a comprehensive policy file - no change.
Plenty of both RAM and disk.
Ports were open in firewall.
Nothing of interest in systemctl status asterisk
, journalctl -xe --unit=asterisk.service
, /var/log/messages
, or /var/log/asterisk/full
.
ps -LlFm -p $(pidof asterisk)
showed the main thread at 99%, but did not correspond to anything in core show threads
.
However, 100% idling did not occur with sudo asterisk -U asterisk -cvvvvv
, so the problem possibly lay not within Asterisk itself, but it how it was started…
After rummaging through systemd files, it appears the culprit is safe_asterisk. Either some combination of parameters, or some subsidiary process started in that script was causing my setup to… do something vigorously?
I renamed away /usr/sbin/safe_asterisk
, copied /contrib/systemd/asterisk.service
to /etc/systemd/system/
, and that seemd to fix everything. Asterisk now idles at <1%