Recurring Asterisk segfaults in res_http_websocket.so (error 4)

Hi everyone,

(Note: English is not my native language; this post was translated from Spanish using Gemini).

We are experiencing repeated crashes/segfaults in Asterisk in our production environment. Looking into /var/log/syslog, the crashes consistently point to res_http_websocket.so (with a couple occurring directly in the main asterisk binary).

/var/log/syslog:2026-10-21T11:49:18.498429-05:00 voice-to-voice-colp-2-1 kernel: asterisk[4089069]: segfault at 140 ip 0000790e54c971d3 sp 0000790db3123ae0 error 4 in res_http_websocket.so[81d3,790e54c93000+6000] likely on CPU 2 (core 1, socket 0)
/var/log/syslog:2026-10-21T14:12:22.705790-05:00 voice-to-voice-colp-2-1 kernel: asterisk[926265]: segfault at 140 ip 00007669425001d3 sp 0000766920909ae0 error 4 in res_http_websocket.so[81d3,7669424fc000+6000] likely on CPU 7 (core 3, socket 0)
/var/log/syslog:2026-10-21T14:22:08.861611-05:00 voice-to-voice-colp-2-1 kernel: asterisk[2344807]: segfault at 140 ip 0000724a664b21d3 sp 0000724a4095cae0 error 4 in res_http_websocket.so[81d3,724a664ae000+6000] likely on CPU 8 (core 4, socket 0)
/var/log/syslog:2026-10-21T14:39:35.371434-05:00 voice-to-voice-colp-2-1 kernel: asterisk[2427667]: segfault at 140 ip 000078d21e13d1d3 sp 000078d21867fae0 error 4 in res_http_websocket.so[81d3,78d21e139000+6000] likely on CPU 2 (core 1, socket 0)
/var/log/syslog:2026-10-22T07:17:31.880429-05:00 voice-to-voice-colp-2-1 kernel: asterisk[1142448]: segfault at 140 ip 00007c493d2711d3 sp 00007c48d35dbae0 error 4 in res_http_websocket.so[81d3,7c493d26d000+6000] likely on CPU 20 (core 10, socket 0)
/var/log/syslog:2026-10-22T07:29:48.057449-05:00 voice-to-voice-colp-2-1 kernel: asterisk[1541414]: segfault at 140 ip 00007ef763b091d3 sp 00007ef716010ae0 error 4 in res_http_websocket.so[81d3,7ef763b05000+6000] likely on CPU 20 (core 10, socket 0)
/var/log/syslog:2026-10-22T07:59:20.355886-05:00 voice-to-voice-colp-2-1 kernel: asterisk[1687463]: segfault at 88 ip 0000630f10f2c7a5 sp 00007059a04fe650 error 4 in asterisk[13e7a5,630f10e35000+231000] likely on CPU 5 (core 2, socket 0)
/var/log/syslog:2026-10-22T08:17:34.642600-05:00 voice-to-voice-colp-2-1 kernel: asterisk[2228341]: segfault at 88 ip 00005d20c85d07a5 sp 00007ee74edb8650 error 4 in asterisk[13e7a5,5d20c84d9000+231000] likely on CPU 23 (core 11, socket 0)
/var/log/syslog:2026-10-22T08:26:03.120436-05:00 voice-to-voice-colp-2-1 kernel: asterisk[2514718]: segfault at 140 ip 000076b52b2b21d3 sp 000076b4e5746b00 error 4 in res_http_websocket.so[81d3,76b52b2ae000+6000] likely on CPU 22 (core 11, socket 0)

Key Observations

  • Most crashes occur at address offset 140 within res_http_websocket.so.

  • Some secondary crashes happen at offset 88 within the main asterisk binary.

  • error 4 indicates a user-space read attempt on unmapped/null memory (likely dereferencing a null or dangling pointer during WebSocket read/write/close operations).

  • Our service handles real-time voice streaming / WebRTC connections over WebSockets.

Environment Details

  • Asterisk Version:
    Asterisk 22.9.0

  • OS / Kernel: 6.17.0-1016-oracle

  • Distribution: 24.04.4 LTS (Noble Numbat)

Has anyone encountered this specific segfault in res_http_websocket.so recently? Any insights on whether this is a known race condition during connection teardown, or if there is a recommended patch/workaround?

I can provide GDB backtraces (bt and bt full) from the generated core dumps if needed.

Thank you for your help!

A few comments:

  1. If you have a backtrace then it should always be provided, otherwise we’re just guessing which can end up being a waste of time and doesn’t help. Providing it initially also eliminates back/forth.
  2. You’re using a version that is old, there have been changes in the latest so upgrading to eliminate that as a factor would be good - otherwise you can end up chasing old issues. If you want to know the changes you can look at the commit history.
  3. You can also look at the issues on Github and see if there’s any open/closed ones in the area.

To get jcolp the backtrace, enable core dumps (dumpcore = yes in asterisk.conf, or start Asterisk with -g) and set the core size limit to unlimited. Ideally rebuild with DONT_OPTIMIZE and BETTER_BACKTRACES in menuselect. After the next crash, run the ast_coredumper script from contrib/scripts against the core file and attach its output. Since it’s the websocket module, also say what’s connecting over websockets (ARI apps, WebRTC clients and so on) and roughly how many connections there are. That should make it much faster to match against the open GitHub issues.

Annoying one. Same offset every time, so it’s a repeatable null pointer deref, not random corruption. Get a real backtrace first. Set dumpcore=yes in asterisk.conf, then run gdb on the core with thread apply all bt full, and compare against your exact version’s release notes. Heads up, those cores hold SIP passwords and TLS keys, and they can fill the disk fast, so cap them.