High memory usage on FreePBX17 Asterisk 20.9.3

We are using FreePBX 17 distro (FreePBX 17.0.19.11) with Asterisk 20.9.3.
We have multiple machines (same hardware config) running on this version, with the same list and version of the freepbx and asterisk modules.

On 2 machines we see a high usage of RAM and CPU. Around 50% CPU and around 2GB of RAM.
The problematic hosts have 120 pjsip extensions and max 10 active calls at the same time. One of such machines is being only used for internal calls only yet.

Another machine where we do not see such issue does have around 150 extensions and the same amount of the max concurrent calls.

The problematic machines does not have any special dialplan configuration other than the ‘normal’ ones.

We do not see any queued taskprocessors on the problematic machines.
During the asterisk CPU jumps we do not see anything in the Asterisk console…

So we are a bit confused.
Maybe somebody experienced the same issue or does anyone know what to do next? :slight_smile:
Thanks!

Have you tried to use htop to identify which processes/threads are causing this high CPU and RAM usage?

Yes, asterisk :slight_smile:

If the asterisk process is the only cause for that CPU spikes, maybe you could try to use the latest Asterisk v20 release (20.10.0) to see if it makes any difference.

This version is not available yet on the Distro apt repo :frowning:

Show the output of htop so we can confirm it is the actual Asterisk process and not some process run by the asterisk user.

I’m sure it is lol

Machine 1:

Machine 2:

Additionally we see the asterisk proccess is crashing by oom killer once it hits 100% memory. No idea what’s causing this inside asterisk

Hi,

We are also seeing with asterisk on 20.X (and FreePBX 16).

Does the problematic servers are using Queue with Local channels while “normal behavior” servers aren’t ?

We downgraded both machines to Asterisk 18.24.3 and it looks like the memory usage is back to a normal behavior…

But maybe it’s a bit early to confim that :slight_smile:
But if so, the question remains the same, why asterisk keeps using a lot of memory on 20.X…

I reproduced the same with latest FreePBX (repo/script based) 17 and out-of-box Asterisk 21.4.3. VM is a test, and had 2GiB, if I put 4GiB VM is stable at 740M. Only thing I did was changing SIP listening address to 9060…

Downgrading to Asterisk 18 looked only at the beginning the solution but I’m afraid it’s not :frowning:
After a while asterisk started back to use a lot of memory…

We also notice a memory issue running FPBX 17.0.19.17 on Debian 12.
All modules are using the latest version.

Before the upgrade from FPBX 15 (On CentOS), the available memory was showing a steady line in our monitoring. Now we see it slowly going down during the day:

Anyone has an idea what could cause this?

You haven’t respond to my post.

18.X (any version) is also impacted by memory leak.
16.X isn’t.

Looks like we see the same memory consumption issue on Asterisk 18.X.

We have now upgraded Asterisk to version 20.10 as we see this in the release notes:

Fixed a memory leak in res_pjsip_outbound_registration.c
    add_security_headers() caused by not specifying OBJ_NODATA in
    an ao2_callback

We also see on the machines with high memory usage there are blf subscriptions with an average of 150+ watchers. Maybe this can cause this high memory usage?

You still haven’t respond to my first post :sweat_smile:

Does the problematic servers are using Queue with Local channels while “normal behavior” servers aren’t ?

as you wish :slight_smile:
We only use Local channels on both machines

Actually I strongly believe the high Mem and CPU usage is the result of the high amount of subscription’s watcher. For example for one extention amount of 370 watchers :smiley:

233@ext-local : PJSIP/233&Custom:DND233,CustomPresence:233 State:Idle Presence:available Watchers 370

Or else

270@ext-local                 : PJSIP/270&Custom:DND270,CustomPresence:270                    State:Unavailable     Presence:available       Watchers 185
271@ext-local                 : PJSIP/271&Custom:DND271,CustomPresence:271                    State:Idle            Presence:available       Watchers 187
272@ext-local                 : PJSIP/272&Custom:DND272,CustomPresence:272                    State:Idle            Presence:available       Watchers 189
273@ext-local                 : PJSIP/273&Custom:DND273,CustomPresence:273                    State:Unavailable     Presence:available       Watchers 189
274@ext-local                 : PJSIP/274&Custom:DND274,CustomPresence:274                    State:Unavailable     Presence:available       Watchers 188
275@ext-local                 : PJSIP/275&Custom:DND275,CustomPresence:275                    State:Idle            Presence:available       Watchers 188
140@ext-local                 : PJSIP/140&Custom:DND140,CustomPresence:140                    State:Unavailable     Presence:available       Watchers 184

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