RestApps has high CPU consumption

I am experiencing an issue where restapps.php has very high CPU utilization on a new install. No phones connected yet and minimal setup/customization on fresh install.

All modules and system updates have been done, firewall configured, OpenVPN server has been set up, truck is set up and routes are set up. Nothing else has been done to the fresh install.

Server is a VPS with 1 CPU.

FreePBX is version: FreePBX 14.0.3.25
RestAPI is version: 13.0.21.1

top shows that php is running near 100%, all the time.

ps aus|grep php shows culprit is restapps.php

asterisk 20798 93.4 3.8 413864 39032 ? Rs 00:24 9:25 php /var/www/html/admin/modules/restapps/restapps.php

Are there any known causes for this, or ways to fix it. Initially i thought it might be caused by a cron job, but the cron jobs all look fine.

Thanks for your help!

Honestly, a 1 core CPU isn’t enough anymore. These little VM instances of 1 CPU / 1 GB RAM just won’t happily run FreePBX anymore.

So either up the VM resources or if you have no plans to use phoneapp/restapps disable the module so it doesn’t get used.

I noticed the same behaviour on my box as well over the weekend. I’m not sure how long it has been doing that though. I’m running the SNG7 Distro (Asterisk 16) as a VM on ESXi 6.7 with all patches applied to SNG7 and upgraded to Edge on the modules just to see if it had been fixed. I’m seeing a php instance at 100% on one core out of the two that I have allocated to the VM. ps aux |grep php reveals that the php instance is restapps.php. I’ve tried killing the process and restarting with fwconsole (both restapps and also everything) and also a reboot but I always end up with restapps at 100% CPU on one core as soon as restapps starts. Happy to provide any logs or do any investigation you might want. Just let me know.

Here are a few more comments, and things I tried:

I upgraded the VPS to 4-core CPU and 8 GB memory. It made no difference. CPU sits at 100% utilization. Memory usage is no problem, even on 1GB.

I disabled RestApps and did fwconsole reload and fwconsole restart. Didn’t make a difference. restapps.php is still running near 100%, even on upgraded CPU.

Below is a picture of the server CPU usage (when on 1-core single CPU). You see a spike during initial install, then usage is 10-15% on average. All of a sudden, it goes to 100%. I believe this time coincides with when I did system and module updates.

My next plan of action is to restore a backup of before i did the updates to see if CPU goes back to normal. If yes, i will do updates 1 by 1 to see which raises the CPU.

We are aware of this and looking into it.

Great, thanks! Look forward to your reply.

Disabling restapps does not stop the process. You’d have to run fwconsole stop restapps

You already know the answer to this.

That did the trick. Running fwconsole stop restapps brought the CPU down to 5%.

Will you be releasing an update for RestApps?

No as the underlying issue is not with restapps.

Ok, understood. I’m assuming whatever is the underlying cause will be updated when the fix is found? Nothing I need to do on my end at this point, correct?

Upgrade to either Framework 15.0.1.19 or Framework 14.0.3.26

Then restart restapps. As the bug is in a library in Framework so you need to rest apps to use the fixed library

3 Likes

I upgraded to 14.0.3.26. Seems to be working well. CPU is not spiking.

Thanks for the quick update!

1 Like

Confirmed fixed. Thanks Andrew!

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