Issue Summary
FreePBX 17 systems running Asterisk 20.21.0 (built 2026-08-31) or Asterisk 22.11.0 can experience rapid, unbounded Asterisk RSS memory growth (1–2+ GB within a few days), eventually triggering OOM kills or heavy swap usage even on low-call-volume systems.
Root Cause
Both Asterisk 20.21.0 and Asterisk 22.11.0 share a res_pjsip_pubsub / extension-state regression where expired inbound BLF/dialog subscriptions (Expiry: 0) are not freed from memory. Over time, thousands of zombie Expiry: 0 subscription objects accumulate in pj_pool_t / anonymous heap.
This is commonly triggered or accelerated by:
- BLF keys monitoring offline/unavailable extensions.
- Phones sending frequent
SUBSCRIBE/Expires: 0refreshes or NAT/firewall setups droppingNOTIFYACKs.
Diagnostic Commands
Check Asterisk RSS and count active vs. expired (Expiry: 0) inbound PJSIP subscriptions:
ps -eo pid,rss,comm --sort=-rss | awk '/asterisk/ {printf "Asterisk RSS: %.1f MB\n", $2/1024; exit}'
asterisk -rx "pjsip show subscriptions inbound" | awk '/Expiry:/ { if ($2==0) z++; else a++ } END { print "Active:", a+0, "Expired(0):", z+0 }'
On affected systems, Expired(0) will climb into the hundreds or thousands while Active remains normal.
Resolution: Switch to Asterisk 22 Certified (22.8-cert / 22.8.4)
Do not use standard Asterisk 20 (20.21.0) or Asterisk 22 (22.11.0) until upstream patches the res_pjsip_pubsub leak.
Instead, switch FreePBX 17 systems to Asterisk 22 (Certified) (Option 7 in asterisk-version-switch, which installs Asterisk 22.8.4). The Certified branch does not include the regression and keeps Expired(0) subscriptions at 0.
asterisk-version-switch
# Select Option 7: Asterisk 22 (Certified)
fwconsole restart
asterisk -rx "core show version"
Note: Asterisk 21 (21.12.3) also avoids this regression, but Asterisk 22 (Certified) is preferred to stay on a supported LTS/Certified track.