New install of v20 idles at 100%

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%

Do you see the same behaviour if you start asterisk with asterisk -c ?

I have never used safe_asterisk myself and I am currently using the scripts inside contrib/systemd for newer systems (without sockets) or contrib/init.d on older systems. There are at most trivial changes necessary to install the daemon.

No, running as non-daemon worked fine. I just didn’t expect this since my test VM was a clean CentOS 7, without the systemd change, and it worked correctly. My installation procedure was identical for both systems, so I guess the production server had a configuration that interfered with Asterisk.

(I checked to see if the systemd files had changed since v18, and I don’t think they have… so, PEBKAC I guess.)

It looks as if your problem is not Asterisk related. One would need to know a lot about your setup and I wouldn’t exclude that your environment has changed.

Agreed. I thought to document this here just in case it helps someone else.

Which document? Do you mean this forum?

One can help only on the basis of facts. The funny thing about telephony is that the core setup is pretty easy with its 3 parameters, but that the own environment can destroy a lot of things in subtle ways. If you want specific help you’d need to describe and show a lot more about your system. On the other hand you should not write a novel. It’s basically an iterative procedure. In your case I’d start with the systemd files in the contrib directory.

If you read websites like this regularly, then you probably have observed that there are a lot of questions like “My system stopped working after upgrading to…”, or “Feature X does not work” and the questioners except an immediate and short answer. As if there is a master plan and a universally valid configuration.

A bit off topic, but I couldn’t resist…

Seen in a larger context, this is the real theme of Eco’s novel “The Name of the Rose.” At first glance it is about solving some crimes (problems with Asterisk) in a monastery, whereby not only evidence is used for solving, but also indirect conclusions about the nature of the problem. Nevertheless, the highly intelligent and experienced William can’t pull all the threads together and indeed there aren’t these universal connections either. His apprentice Adson remarks at one point that he doubts whether the William really always has everything under control. It looks like a story set in the Christian Middle Ages, but it’s actually an introduction to the ideas of postmodernism (and thus the acceptance of a complex world instead of a simple God given order). It’s the same here. Even the most experienced writers here cannot interpret all the symbols immediately. Sometimes the right details lead to a solution.

1 Like

Yes. If I had stumbled upon this post, I could’ve saved myself hours of futile Googling.

I didn’t ask for help. I had a problem. I solved the problem. I summarised the steps I took to try and diagnose it, and my eventual solution. If, at some point in the future, someone has the same symptoms then I hope they find this post, and it either helps them, or allows them to cross a few items off the list of potential solutions.

Why is this so unusual as to be discussed? Do people really not do this any more? Would you really prefer me to be a denvercoder9?

Please try?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.