[LBBS-121] mod_asterisk_queues: Memory corruption or use after free in agent list

ASTERISK-171
chan_iax2: Crash due to memory corruption following packet decrypt failures
DAHLIN-12
oct612x, wct4xxp: Compilation failure on next kernel
LBBS-103
mod_webmail: Crash when FETCH fails after retry due to no messages returned
PHREAKSCRIPT-20
dsp.c: coin DSP patch breaks faxing
LBBS-110
Support TDD message lines
ASTERISK-174
func_channel: Allow manually changing channel format
LBBS-127
net_tap: Add support for TAP/IXO paging protocol
ASTERISK-82
app_queue: Allow queue strategy to be manipulated externally
LBBS-121
mod_asterisk_queues: Memory corruption or use after free in agent list
LBBS-109
net_telnet: Local echo remains enabled in some cases
PHREAKSCRIPT-66
dahdi_vpmadt032_loader.o: unannotated intra-function call
ASL-6
app_rpt: Allow dialplan to be executed when placing calls
ASTERISK-122
res_pjsip_device_features: Excessive refcount on endpoint object
ASTERISK-149
sig_analog: Winks from dialplan don't propagate onto DAHDI channels
LBBS-102
mod_smtp_filter: Received header no longer has 'for' recipient included
LBBS-80
tests: Jump to invalid address on the next line
LBBS-98
net_smtp: Fix message processing actions being skipped in some cases
LBBS-86
Deadlock on internal lock mutex
PHREAKNET-54
Fix trunking to Telstar
DAHTOOL-5
Disabling span auto-assignment implodes kernel
PHREAKSCRIPT-36
app_audichron: Tone not working after announcements
PHREAKNET-6
Verification flags international calls
PHREAKSCRIPT-56
DAHDI Tools: Apply unmerged patches
ASTERISK-124
app_mixmonitor: Allow cancelling in-progress recording/recipients
DAHTOOL-4
dahdi_genconf: Hangs when run initially after span assignment
INTERLINKED-24
Improve programmatic interfaces to issues
ASTERISK-93
chan_dahdi: DSP optimizations
LBBS-31
mod_sieve: Major Sieve filtering overhaul and improvements
PHREAKNET-34
Pat Fleet prompts
LBBS-16
io_compress: Occasional memory corruption on shutdown
CAMI-1
Action Originate Returns -1
LBBS-13
pty.c: Attempt to acquire node lock after it's been destroyed
PHREAKSCRIPT-53
app_george: Cancel in-progress recording if nobody said anything
ASTERISK-175
app_mixmonitor: Can record multiple times to same file
ASTERISK-142
res_pjsip_caller_id: P-Charge-Info should be used for ANI
ASTERISK-146
res_agi: callingani2 is not formatted as 2 digits
ASTERISK-168
chan_iax2: Make refresh interval configurable
ASL-5
app_rpt: DAHDI tones not working for genchannel
ASTERISK-160
chan_dahdi: Add timer for caller subscriber held
DOCS-3
verify.conf: Boilerplate uses hardcoded paths for astkeydir
LBBS-96
pty: CR NUL is sometimes split up, leaking to flaky test
ASTERISK-100
chan_dahdi: PRI lock held at module unload
ASTERISK-143
func_sysinfo: Add options to retrieve current verbose/debug levels
ASTERISK-109
voicemail.conf.sample: Clarify misnamed option behavior
WSSMAIL-3
Message listing missing recipient for some messages
ASTERISK-137
sig_analog: Add alternate dial pulse scheme support
ASTERISK-176
chan_pjsip: Add "none" DTMF method
LBBS-65
net_smtp: Allow internal trusted hosts to be exempt from protocol violation checks
ASTERISK-102
app_voicemail: Play RDNIS if present when listening to envelope
DAHLIN-4
Improve manual span assignment process
ASTERISK-81
format_lame: MP3 read and write with LAME library
ASTERISK-23
logging: Update log levels
PHREAKSCRIPT-76
ast_safe_sleep: Memory corruption when freeing frames
ASTERISK-68
res_pjsip_sca: Segfaults on startup with SCA
ASTERISK-154
app_dial: Dialplan freeze during announcement
ASTERISK-88
chan_dahdi: Add ADSI on-hook download support
ASTERISK-83
res_pjsip_device_features: Add forwarding and DND synchronization
ASTERISK-19
chan_dahdi: Remove sig_analog paths
PHREAKSCRIPT-78
chan_sccp: Don't know how to send format
ASTERISK-144
chan_pjsip: Add support for directrtpsetup
PHREAKNET-66
Allow signaling when through on coin calls
LBBS-113
Add support for TOTP two-factor and app passwords
ASTERISK-130
Verify that res_xmpp can compile and be used
ASTERISK-155
chan_iax2: Barrage of DTMF frames can cause channel to hang
LBBS-107
mod_sieve: Segfault in lib libsieve_strbuffree during message delivery
PHREAKSCRIPT-65
wanpipe: wanpipe modules fail to load
DAHLIN-9
No rule to make target 'vpmadt032_loader/vpmadt032_x86_64.o'
ASTERISK-71
app_if: ElseIf executed even if If is true
PHREAKNET-40
Recent Change provisioning bug increments device name by 1
ASTERISK-159
chan_dahdi: Remove unused code
PHREAKSCRIPT-73
res_smdr_whozz: Heuristically use call progress to determine if call was answered
LBBS-70
mod_smtp_delivery_external: Use SRS for externally forwarded messages
PHREAKNET-52
Cisco end of CSR signing support
DAHLIN-7
Mega-issue to upstream out-of-tree DAHDI patches
ASTERISK-97
func_groupcount: Add group vars
PHREAKNET-35
TSPS improvements
PHREAKNET-23
Wakeup calls not dialling at scheduled time
ASTERISK-101
func_tonedetect: 2600 Hz detection not working or suboptimal
LBBS-32
mod_spamassassin: Improve default spam handling
PHREAKSCRIPT-72
res_smdr_whozz: Build/support loop follower circuit for pulse support
ASTERISK-152
app_queue: Allow ringall to be combined with other settings
PHREAKSCRIPT-67
Add rate limiting application
ASTERISK-147
res_smdi: Allow Asterisk to be the SMDI server
LBBS-6
Add MenuScript, a menu system scripting engine
SLACK-5
Failed to receive reply... when message sent
ASTERISK-131
chan_dahdi: Automatically update time when DST starts/ends
ASTERISK-115
chan_iax2: Some pattern matches ignored if included in incoming context
ASTERISK-112
chan_dahdi: Raw power ring audible on recall ring from IAX2 to DAHDI
ASTERISK-66
app_sf: ReceiveSF not detecting incoming SF
EVERGREEN-1
Use default identity per folder
ASTERISK-140
res_pjsip_session: Add support for SIP-ISUP
LBBS-34
net_xmpp: Add XMPP protocol support
PHREAKSCRIPT-74
Finish real time inpulsing support
ASTERISK-110
chan_iax2: Implement MWI
ASTERISK-75
chan_dahdi: Add Call Hold feature
LBBS-92
Gmail bug causes disconnect after MOVE of certain messages
LBBS-129
editor.c: Small terminal widths lead to drawing issues
LBBS-95
mod_mailscript: Add ADDFLAG action
DAHTOOL-8
autoreconf fails
LBBS-97
system.c: Evaluate shell syntax/variables when launching programs
LBBS-88
net_imap: IDLE data not being processed in realtime
ASTERISK-134
chan_dahdi: Improve configuration validation
INTERLINKED-20
Closing multiple issues simultaneously doesn't work
DAHTOOL-7
Unknown type bool in Rocky Linux 9.2
LBBS-58
net_irc: Make ping interval adjustable
DAHLIN-1
Makefile: remove update target
ASL-7
app_rpt: Add XML documentation
PHREAKNET-47
Add automation for bill mailings
ASTERISK-164
chan_dahdi: Allow setting/getting lastexten from dialplan
ASTERISK-156
chan_dahdi: Clean up permanent/transient private variables
LBBS-71
Limit registrations from same IP within a certain amount of time
ASTERISK-63
Upstream certain PhreakScript modules
PHREAKSCRIPT-43
Add spanconfig command
ASTERISK-106
chan_pjsip: Modify From header appropriately for unavailable presentation
ASTERISK-123
app_voicemail: Add ability to disable "thank-you" when ending voicemail
ASTERISK-104
Improve dahdi show channels output
ASTERISK-64
chan_dahdi: autoreoriginate doesn't work if caller hung up on
LBBS-66
logger: Add rate limiting of log messages
INTERLINKED-16
Add option to not be notified about user's own issues
LBBS-46
Block malicious mail servers after repeated failures
ASTERISK-52
dsp.c: Add ast_freq_reset
ASTERISK-73
chan_dahdi: Hunt to next trunk in group if busy
ASTERISK-65
sig_analog: Allow simple switch to time out to dialplan
LBBS-11
door_evergreen: Use isonetexec instead of exec
LBBS-7
Fix backspace detection/handling
ASTERISK-37
chan_pjsip: CALLERID(ani2) not working
ASTERISK-36
res_pjsip_logger: Add filtering by username
ASTERISK-58
xml: Add config documentation
PHREAKSCRIPT-69
res_alarmsystem: Add additional environmental integration
ASTERISK-84
Add 'core show variables' command
ASTERISK-74
chan_dahdi: Add AMI event for callwaiting
ASTERISK-8
Optimize boilerplate RSA to MD5 fallback
ASL-4
Add framehook module to convert between mute/unmute and radio key/unkey
ASTERISK-157
chan_dahdi: Empty voicemail messages on hangup
ASTERISK-27
chan_dahdi: add IS_FXO_SIG macro
ASTERISK-163
Add support for KP2
ASTERISK-72
chan_dahdi: Move documentation to separate file
SLACK-2
README: Add missing pre-reqs
ASTERISK-55
chan_dahdi: add NUM_ANALOG_SUBS
ASTERISK-42
sig_pri: Add CLI description
ASTERISK-34
app_queue: Allow setting context at runtime
ASTERISK-30
Add ast_channel_tech_name_match function
ASTERISK-29
chan_iax2: Add ${CHANNEL(authmethod)}
ASTERISK-18
func_frame_drop: Simplify and improve
ASTERISK-15
chan_dahdi: Allow sending SDMF Caller ID
ASTERISK-98
Add hangup callbacks
ASTERISK-47
res_pjsip_session: Warn if no shared codecs
LBBS-128
thread.c: Recursive lock attempt between find_thread and thread_unregister
PHREAKSCRIPT-49
wanpipe doesn't compile above 6.1 kernel
ASTERISK-86
app_confbridge: Channel can join wrong bridge due to race condition
LBBS-56
net_snpp: Add Simple Network Paging Protocol support
INTERLINKED-6
PhreakNet Forums
ASTERISK-169
stasis: Memory corruption in channel_snapshot_dialplan_create
ASTERISK-165
res_calendar_icalendar: SEGV during module refresh
LBBS-117
TLS/IMAP: Add extensible/detailed logging info
DAHLIN-14
DAHDI modules fail to load with error: loading out-of-tree module taints kernel
DAHLIN-6
Frame relay broken
LBBS-74
net_ssh: Sessions persist even when they no longer exist
DAHLIN-10
Allow enabling EMPULSE and EMFLASH simultaneously
LBBS-82
localtime_r deadlock
ASTERISK-135
Mutex errors on FreeBSD
LBBS-41
socket.c: SEGV in bbs_node_readline
LBBS-69
net_ssh: SFTP uploads fail with WinSCP
PHREAKSCRIPT-19
app_verify: Double free
PHREAKNET-14
1+ calls do not work for single numbers
PHREAKSCRIPT-75
Add support for DNVT military phones
LBBS-47
Email enhancements
LBBS-90
mod_smtp_delivery_external: Improve queuing process
PHREAKSCRIPT-37
app_softmodem: Support speeds higher than 2400bps
EVERGREEN-3
Add NNTP support for newsgroups
LBBS-48
net_irc: Support multi-server networks
PHREAKNET-39
Splice Fred Covington prompts for speaking clock
WSSMAIL-5
Add full attachment support
ASTERISK-129
core: Add ref/unref for ast_moh callbacks
DAHLIN-8
Readd native SF support
PHREAKNET-49
ML model for 3-slot coin detection
PHREAKSCRIPT-45
TDMoIP driver module
PHREAKSCRIPT-44
Finish ADSI applications
PHREAKSCRIPT-41
Create virtual modem application using softmodem
PHREAKNET-41
Allow for more granular billing based on switch ZIP code
PHREAKNET-33
Finish TSPS web console
LBBS-72
mod_webdav: Add WebDAV support
ASTERISK-118
chan_iax2: Improve encryption support
DAHLIN-5
FXO rings off hook when rotary dialing on the line
ASTERISK-105
chan_dahdi: Add CLI command to display line voltages
WSSMAIL-13
Improve multi-INBOX navigation
LBBS-38
mod_smtp_mailing_lists: Allow dynamic membership
LBBS-36
net_telnet: Improve protocol support
LBBS-35
net_acap: Add ACAP protocol support
WSSMAIL-4
Add PHPMailer support for format=flowed
ASTERISK-7
Improve sound control capabilities
LBBS-49
Add functionality expected of a traditional BBS package
LBBS-30
net_nntp: Complete overhaul/rewrite to use maildirs
ASTERISK-99
pjsip: Add Cisco CUCM patch functionality
LBBS-33
net_imap: Add/standardize commands to modify or purge keywords
ASTERISK-57
bridging: Make DAHDI, always softmix bridging modules
LBBS-91
readline.c: Crash in memmove
EVERGREEN-2
Navigation breaks when requirefromhelomatch=no in LBBS
DOCS-1
Kickstart the wiki
ASTERISK-87
asterisk.c: Prevent creation of duplicate Asterisk processes
DAHTOOL-2
dahdi_cfg: Compiler warnings
PHREAKNET-36
Trunking integration with Phil McCarter
LBBS-130
test_imap_msn: Flaky test
PHREAKNET-65
ZEnith numbers don't bill properly
ASTERISK-172
chan_dahdi: DAHDI FXO channels can stay busy on repeated access attempts
ASTERISK-170
app_voicemail: Read-only option doesn't prevent move operations
LBBS-124
net_http: Allow for multiple virtualhosts
ASTERISK-167
sig_analog: Improve Call Forwarding implementation
ASTERISK-166
sig_analog: Make call waiting hangup behavior configurable
EVERGREEN-4
Expunge of folder with mix of \Deleted messages results in stale view
LBBS-112
mod_asterisk_ami: Exponential backoff logic busy loops instead
LBBS-111
mod_asterisk_ami: Add multi-Asterisk support
DAHTOOL-6
Support ppp 2.5.0
PHREAKNET-58
TSPS phrasing is not correct
PHREAKSCRIPT-62
res_smdr_whozz: Initialization usually fails in practice
DAHTOOL-3
Compilation warnings on 32-bit (i686)
PHREAKSCRIPT-33
verify.conf: Flag invalid NXXs as illegitimate for NANPA calls
LBBS-61
net_imap: Soft assertion in parse_flags_string
LBBS-63
net_imap, io_compress: Spurious warnings if quota exceeded
LBBS-39
net_smtp: Occasional memory corruption on email delivery
LBBS-37
Restrict outgoing port 25 from containers while allowing other traffic
LBBS-23
net_smtp: DMARC reports not sent due to rejection of localhost
LBBS-20
node.c: Occasional race conditions during node shutdown cause deadlock
LBBS-17
Temporary files not always cleaned up
LBBS-79
Makefile: cp -n is deprecated
PHREAKSCRIPT-35
app_mail: SendMail returns SUCCESS
LBBS-51
General TDD improvements
PHREAKSCRIPT-23
res_phreaknet: Increase cURL timeout
ASTERISK-94
app_chanspy: Fix bad audio with single direction operation
ASTERISK-76
app_dial: Allow MOH until progress received
LBBS-28
mod_discord: Warn users if IRC users are not online
PHREAKSCRIPT-16
app_selective: Missing pause after add/delete/instructions prompt
ASTERISK-43
pbx_builtins: allow Answer to specify the channel
ASTERISK-35
sig_analog: Fix buffer overflow
PHREAKNET-61
Create a webpage for the operator automatic traffic generator
ASTERISK-153
app_confbridge: Allow disabling the CBAnn channel
DAHLIN-11
Use dev_addr_set instead of directly modifying const buffer
PHREAKSCRIPT-58
sig_analog: Allow hearpulsing gain to be adjusted
ASTERISK-128
Rename ast_sip_presence_xml_ functions
ASTERISK-127
func_codecs: view/update codecs
WSSMAIL-15
Allow navigating messages using arrow keys
PHREAKSCRIPT-29
res_phreaknet: Don't try making API requests if not a PhreakNet node
LBBS-59
Add HTTP endpoint for updating IRC presence automatically
WSSMAIL-14
Checkbox range selection doesn't always work reliably
SLACK-3
examples: Add example program to log everything to a CSV
PHREAKSCRIPT-22
Add framehook to display dialed digits
PHREAKSCRIPT-21
app_looparound: Add LoopAround application
LBBS-45
Use isoexec whenever possible
PHREAKSCRIPT-17
res_phreaknet: iax.conf, et. al. are truncated when there is no disk space left
LBBS-43
mod_discord: Improve handling of in-thread replies

← All Issues || New Issue →

Sort Normal || Priority

Details


Referencing Issues

[LBBS-120] mod_asterisk_ami: NULL dereference possible if ami_session is currently NULL


This crash has been observed on two different occasions, though not in close proximity, so this is not a frequent crash, but does seem consistent.

The logs make it clear that something like this happens:

What's strange is that there seems to be some kind old stale call in the calls list, but what causes the crash is an invalid agent in the agents list.

Here is another recent occurence of this issue:

[2026-02-08 01:45:04.665]   DEBUG[3099452]: mod_asterisk_queues.c:571 ami_callback: Processing queue event 'QueueCallerJoin'
[2026-02-08 01:45:04.668]   DEBUG[3099452]: mod_asterisk_queues.c:502 new_call: Added call from '2310112' (Local/0@phreaknet-operators-00009a26;2) to queue 'phreaknet-operator' as call 0
[2026-02-08 01:45:04.670]   DEBUG[3099452]: mod_asterisk_queues.c:571 ami_callback: Processing queue event 'AgentCalled'
Segmentation fault (core dumped)

Thread 1 (Thread 0x7f39ce3896c0 (LWP 3099452)):
#0  0x00007f39cf0f0149 in agent_printf (queue=0x7f39c803afe0, member_name=0x7f39c442be40 "980", fmt=0x7f39cf0f446f "%s\r%s%-15s %-22s %15s\n") at mod_asterisk_queues.c:526
        buf = 0x7f39c40daa40 "\033[0m\r\aACD RING        OPERATOR", ' ' <repeats 23 times>, "2310112\n"
        len = 61
        ap = {{gp_offset = 48, fp_offset = 48, overflow_arg_area = 0x7f39ce288cb0, reg_save_area = 0x7f39ce288be0}}
        agent = 0xd2
        agent_id = 980
        __func__ = "agent_printf"
#1  0x00007f39cf0f0727 in ami_callback (e=0x7f39c40f9520, eventname=0x7f39c4803f40 "AgentCalled") at mod_asterisk_queues.c:601
        callerid = 0x7f39c48af530 "2310112"
        member_name = 0x7f39c442be40 "980"
        queue_name = 0x7f39c4007e90 "phreaknet-operator"
        queue = 0x7f39c803afe0
        __func__ = "ami_callback"
#2  0x00007f39cf795e3b in ami_callback (ami=0x559519ddc590, event=0x7f39c40f9520) at mod_asterisk_ami.c:218

(gdb) print agent
$1 = (struct agent *) 0xd2
(gdb) print agents
$2 = {first = 0x7f39c0645310, last = 0x7f39c000ad20, lock = {lock = {__data = {__readers = 8, __writers = 0, __wrphase_futex = 0, __writers_futex = 0, __pad3 = 0, __pad4 = 0, __cur_writer = 0,
        __shared = 0, __rwelision = 0 '\000', __pad1 = "\000\000\000\000\000\000", __pad2 = 0, __flags = 0}, __size = "\b", '\000' <repeats 54 times>, __align = 8}, intlock = {__data = {__lock = 0,
        __count = 0, __owner = 0, __nusers = 0, __kind = 0, __spins = 0, __elision = 0, __list = {__prev = 0x0, __next = 0x0}}, __size = '\000' <repeats 39 times>, __align = 0}, info = {
      initialized = 1, staticinit = 1, destroyed = 0, owners = 1, lastlocked = 1770515104, lwp = 3099452, lineno = 522, filename = "mod_asterisk_queues.c\000\000"}}}
(gdb) print agents.first
$4 = (struct agent *) 0x7f39c0645310
(gdb) print *agents.first
$5 = {id = 884, node = 0x7f39c48aef80, idle = 1, gotwritten = 0, stale = 0, entry = {next = 0x7f39c8122d30}}
(gdb) print (*agents.first).entry
$6 = {next = 0x7f39c8122d30}
(gdb) print (*agents.first).entry.next
$7 = (struct agent *) 0x7f39c8122d30
(gdb) print *((*agents.first).entry.next)
$8 = {id = 231, node = 0x7f39c02e30d0, idle = 1, gotwritten = 0, stale = 0, entry = {next = 0x7f39bc23bb50}}
(gdb) print *((*agents.first).entry.next).entry.next
$9 = {id = 1335238491, node = 0xbc71f11fc8dc52f7, idle = 0, gotwritten = 1, stale = 0, entry = {next = 0xd2}}

Here, id, node, and entry.next are all bogus, so it's not specifically the current agent that is invalid, but the previous agent in the list whose entry.next points to it. How that entry got to be that way (whether it was previously valid and then freed but not removed from the list, etc.) is the mystery now.

More complete logs filed at X:\Development\LBBS-121.txt - from these additional logs it seems a call comes into the agent, who handles the call, but does NOT return to the main menu before the second call comes in, i.e. the call becomes dead while the agent is in a submenu.

(m:ss)
2:33 IAX2/phreaknet-13486 calls 0
2:38 Answers
2:46 press l
2:48 choose call 0
2:58 Choose [S] option and key number, hit ENTER
LBBS/asterisk merged timeline:

3:05 Far end answers
3:08 far end hangs up
3:09 caller gets disconnected

3:16 press ENTER
3:16 IAX2/phreaknet-78 calls 0 using 231 DISA
3:19 press l
3:23 answers
3:27 choose call 0
3:31 choose option 3 ([S])
3:46 enter number and hit ENTER. do not touch terminal from now on
3:58 xfer complete
4:06 caller gets disconnected

4:11 IAX2/phreaknet-16132 calls 0 (crash)

Reproducing 3:16-4:11 sequence does give similar log results:
[2025-09-27 09:02:27.480]   DEBUG[32945]: mod_asterisk_queues.c:571 ami_callback: Processing queue event 'QueueCallerJoin'
[2025-09-27 09:02:27.554]   DEBUG[32945]: mod_asterisk_queues.c:397 call_is_dead: Marking queue call 0 as dead: IAX2/phreaknet-14122
[2025-09-27 09:02:27.554]   DEBUG[32945]: mod_asterisk_queues.c:502 new_call: Added call from 'REDACTED' (IAX2/phreaknet-10052) to queue 'phreaknet-operator' as call 0
[2025-09-26 20:03:17.485]   DEBUG[83287]: mod_asterisk_queues.c:495 new_call: Added call from '8848537' (IAX2/phreaknet-78) to queue 'phreaknet-operator' as call 0
...
[2025-09-26 20:04:11.945]   DEBUG[83287]: mod_asterisk_queues.c:564 ami_callback: Processing queue event 'QueueCallerJoin'
[2025-09-26 20:04:11.947]   DEBUG[83287]: mod_asterisk_queues.c:361 __mark_dead: Marking queue call 0 as dead: IAX2/phreaknet-78
[2025-09-26 20:04:11.947]   DEBUG[83287]: mod_asterisk_queues.c:495 new_call: Added call from '8848537' (IAX2/phreaknet-16132) to queue 'phreaknet-operator' as call 0
[2025-09-26 20:04:11.948]   DEBUG[83287]: mod_asterisk_queues.c:564 ami_callback: Processing queue event 'AgentCalled'
Segmentation fault (core dumped)

Thread 1 (Thread 0x7f489ee486c0 (LWP 83287)):
#0  0x00007f48a058b0ca in agent_printf (queue=0x5623b503d550, member_name=0x7f4894085760 "791", fmt=0x7f48a058f40f "%s\r%s%-15s %-22s %15s\n") at mod_asterisk_queues.c:519
        buf = 0x7f4890006120 "\033[0m\r\aACD RING        OPERATOR", ' ' <repeats 23 times>, "8848537\n"
        len = 61
        ap = {{gp_offset = 48, fp_offset = 48, overflow_arg_area = 0x7f489ed47cb0, reg_save_area = 0x7f489ed47be0}}
        agent = 0x51858d6eaed7cf55
        agent_id = 791
        __func__ = "agent_printf"
#1  0x00007f48a058b6ba in ami_callback (e=0x7f4894087040, eventname=0x7f48940049a0 "AgentCalled") at mod_asterisk_queues.c:594
        callerid = 0x7f489400bef0 "8848537"
        member_name = 0x7f4894085760 "791"
        queue_name = 0x7f4894011490 "phreaknet-operator"
        queue = 0x5623b503d550
        __func__ = "ami_callback"
#2  0x00007f48a0c866b3 in ami_callback (ami=0x5623b5039a60, event=0x7f4894087040) at mod_asterisk_ami.c:115
        res = -1
        cb = 0x5623b503deb0
        do_reload = 0
        eventname = 0x7f48940049a0 "AgentCalled"
        __func__ = "ami_callback"
#3  0x00007f48a0877c86 in ami_event_dispatch (varg=0x5623b5039a60) at cami.c:806
        bytes_used = <optimized out>
        start = 0x7f489ed47ea0 "Event: AgentCalled\r\nPrivilege: agent,all\r\nTimestamp: 1758917051.950755\r\nSystemName: ARTNVAAXCG0\r\nChannel: IAX2/phreaknet-16132\r\nChannelState: 4\r\nChannelStateDesc: Ring\r\nCallerIDNum: 8848537\r\nCallerIDN"...
        end = 0x7f489ed4826a ""
        fds = {fd = 16, events = 1, revents = 1}
        event = <optimized out>
        res = 971
        buf = Python Exception <class 'gdb.error'>: value requires 1048576 bytes, which is more than max-value-size
#4  0x00007f48a0f1f1f5 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
        ret = <optimized out>
        pd = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {139949880149696, 5120490681186163102, -136, 25, 140732927007232, 139949871759360, -5071441385835685474, -5071366787108529762}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
#5  0x00007f48a0f9f8dc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Normal call (for comparison):
[2025-09-26 20:30:15.509]   DEBUG[15891]: mod_asterisk_queues.c:564 ami_callback: Processing queue event 'QueueCallerJoin'
[2025-09-26 20:30:15.596]   DEBUG[15891]: mod_asterisk_queues.c:495 new_call: Added call from '2703330' (IAX2/phreaknet-1029) to queue 'phreaknet-operator' as call 0
[2025-09-26 20:30:15.596]   DEBUG[15891]: mod_asterisk_queues.c:564 ami_callback: Processing queue event 'AgentCalled'
...
[2025-09-26 20:30:15.596]   DEBUG[15891]: mod_asterisk_queues.c:564 ami_callback: Processing queue event 'AgentCalled'
[2025-09-26 20:30:20.329]   DEBUG[15891]: mod_asterisk_queues.c:564 ami_callback: Processing queue event 'QueueCallerAbandon'
[2025-09-26 20:30:20.330]   DEBUG[15891]: mod_asterisk_queues.c:361 __mark_dead: Marking queue call 0 as dead: IAX2/phreaknet-1029
[2025-09-26 20:30:20.330]   DEBUG[15891]: mod_asterisk_queues.c:564 ami_callback: Processing queue event 'QueueCallerLeave'

This non-crashing deadlock(?) is possibly related?

[2025-10-06 19:40:50.815] WARNING[369356]: mod_asterisk_queues.c:206 del_agent: Spent 91 seconds so far waiting to wrlock &agents, possible deadlock? (rwlock acquired at mod_asterisk_queues.c:515 30 s ago by LWP 369313)
[2025-10-06 19:40:50.816]   ERROR[369356]: backtrace.c:255 bbs_log_backtrace: Got 13 backtrace records
[2025-10-06 19:40:51.261]   ERROR[369356]: backtrace.c:279 bbs_log_backtrace:  0: lbbs bbs_log_backtrace()
[2025-10-06 19:40:51.261]   ERROR[369356]: backtrace.c:279 bbs_log_backtrace:  1: lbbs __bbs_rwlock_wrlock()
[2025-10-06 19:40:51.261]   ERROR[369356]: backtrace.c:279 bbs_log_backtrace:  2: [0x7fe42b152c71] mod_asterisk_queues.so       mod_asterisk_queues.c:206   del_agent()
[2025-10-06 19:40:51.261]   ERROR[369356]: backtrace.c:279 bbs_log_backtrace:  3: [0x7fe42b15669e] mod_asterisk_queues.so       mod_asterisk_queues.c:1191  agent_exec()
[2025-10-06 19:40:51.262]   ERROR[369356]: backtrace.c:279 bbs_log_backtrace:  4: lbbs bbs_door_exec()
[2025-10-06 19:40:51.262]   ERROR[369356]: backtrace.c:279 bbs_log_backtrace:  5: lbbs menu_handler_exec()
[2025-10-06 19:40:51.262]   ERROR[369356]: backtrace.c:279 bbs_log_backtrace:  6: lbbs <unknown>()
[2025-10-06 19:40:51.262]   ERROR[369356]: backtrace.c:279 bbs_log_backtrace:  7: lbbs bbs_node_menuexec()
[2025-10-06 19:40:51.262]   ERROR[369356]: backtrace.c:279 bbs_log_backtrace:  8: lbbs <unknown>()
[2025-10-06 19:40:51.262]   ERROR[369356]: backtrace.c:279 bbs_log_backtrace:  9: lbbs bbs_node_handler()
[2025-10-06 19:40:51.263]   ERROR[369356]: backtrace.c:279 bbs_log_backtrace: 10: lbbs <unknown>()
[2025-10-06 19:40:51.263]   ERROR[369356]: backtrace.c:279 bbs_log_backtrace: 11: [0x7fe42baa71f5] libc.so.6                         pthread_create.c:442   start_thread()
[2025-10-06 19:40:51.263]   ERROR[369356]: backtrace.c:279 bbs_log_backtrace: 12: [0x7fe42bb278dc] libc.so.6                                 clone3.S:83    clone3()

Here is a more recent example where the address of agent is 0x45, clearly invalid:

[2025-12-19 16:48:31.805]   DEBUG[1945271]: mod_asterisk_queues.c:571 ami_callback: Processing queue event 'QueueCallerJoin'
[2025-12-19 16:48:31.806]   DEBUG[1945271]: mod_asterisk_queues.c:502 new_call: Added call from '12632056' (IAX2/phreaknet-11380) to queue 'phreaknet-operator' as call 0
[2025-12-19 16:48:31.806]   DEBUG[1945271]: mod_asterisk_queues.c:571 ami_callback: Processing queue event 'AgentCalled'
[2025-12-19 16:48:31.818]    AUTH[1945273]: net_msp.c:379 msp_udp_listener: Received new Message Send Protocol message from 10.116.0.5
[2025-12-19 16:48:31.818]   -- Handling Message Send Protocol version 2 message
[2025-12-19 16:48:31.819]   DEBUG[1945273]: socket.c:2857 bbs_auto_any_fd_writef: Discarding write output (no node and no fd)
[2025-12-19 16:48:31.819]   DEBUG[1945273]: net_irc.c:845 __channel_broadcast: (1/0) <= :MSP/ARTNVAAXCG0!MSP@10.116.0.5 PRIVMSG #phreaknet-operators :OPSRV phreaknet-operator - "REDACTED" <12632056>
[2025-12-19 16:48:31.819]   DEBUG[1945273]: net_msp.c:216 msp_response: MSP response <= +
Segmentation fault (core dumped)

Thread 1 (Thread 0x7fb757fff6c0 (LWP 1945271)):
#0  0x00007fb75de4b172 in agent_printf (queue=0x561f5ae39ba0, member_name=0x7fb748201d40 "234051", fmt=0x7fb75de4f46f "%s\r%s%-15s %-22s %15s\n") at mod_asterisk_queues.c:526
        buf = 0x7fb74812a270 "\033[0m\r\aACD RING        OPERATOR", ' ' <repeats 22 times>, "12632056\n"
        len = 61
        ap = {{gp_offset = 48, fp_offset = 48, overflow_arg_area = 0x7fb757efecb0, reg_save_area = 0x7fb757efebe0}}
        agent = 0x45
        agent_id = 234051
        __func__ = "agent_printf"
#1  0x00007fb75de4b762 in ami_callback (e=0x7fb748201870, eventname=0x7fb748005d50 "AgentCalled") at mod_asterisk_queues.c:601

(gdb) thread 1
[Switching to thread 1 (Thread 0x7fb757fff6c0 (LWP 1945271))]
#0  0x00007fb75de4b172 in agent_printf (queue=0x561f5ae39ba0, member_name=0x7fb748201d40 "234051", fmt=0x7fb75de4f46f "%s\r%s%-15s %-22s %15s\n") at mod_asterisk_queues.c:526
526                     if (!agent->idle) {
(gdb) print *agent
Cannot access memory at address 0x45

Related (notice the thread deadlocked itself?):

[2025-10-27 21:19:02.772] WARNING[753110]: mod_asterisk_queues.c:188 del_agent: Spent 31 seconds so far waiting to wrlock &queues, possible deadlock? (rwlock acquired at mod_asterisk_queues.c:733 30 s ago by LWP 753110)

Here is another instance where we seem to have some kind of recursive deadlock (at least it was appear, since the logs say thread 1943176 is deadlocked by... itself?)

[2025-12-18 21:39:03.040] WARNING[1943176]: mod_asterisk_queues.c:188 del_agent: Spent 40 seconds so far waiting to wrlock &queues, possible deadlock? (rwlock acquired at mod_asterisk_queues.c:734 30 s ago by LWP 1943176)
[2025-12-18 21:39:03.153]   ERROR[1943176]: backtrace.c:255 bbs_log_backtrace: Got 14 backtrace records
[2025-12-18 21:39:03.833]   ERROR[1943176]: backtrace.c:279 bbs_log_backtrace:  0: lbbs bbs_log_backtrace()
[2025-12-18 21:39:03.835]   ERROR[1943176]: backtrace.c:279 bbs_log_backtrace:  1: lbbs __bbs_rwlock_wrlock()
[2025-12-18 21:39:03.836]   ERROR[1943176]: backtrace.c:279 bbs_log_backtrace:  2: [0x7f8491027aa3] mod_asterisk_queues.so       mod_asterisk_queues.c:189   del_agent()
[2025-12-18 21:39:03.838]   ERROR[1943176]: backtrace.c:279 bbs_log_backtrace:  3: [0x7f849102b7cc] mod_asterisk_queues.so       mod_asterisk_queues.c:1204  agent_exec()
[2025-12-18 21:39:03.840]   ERROR[1943176]: backtrace.c:279 bbs_log_backtrace:  4: lbbs bbs_door_exec()
[2025-12-18 21:39:03.841]   ERROR[1943176]: backtrace.c:279 bbs_log_backtrace:  5: [0x7f846a7d6421] mod_menu_handlers.so           mod_menu_handlers.c:81    door_handler()
[2025-12-18 21:39:03.843]   ERROR[1943176]: backtrace.c:279 bbs_log_backtrace:  6: lbbs menu_handler_exec()
[2025-12-18 21:39:03.845]   ERROR[1943176]: backtrace.c:279 bbs_log_backtrace:  7: lbbs <unknown>()
[2025-12-18 21:39:03.846]   ERROR[1943176]: backtrace.c:279 bbs_log_backtrace:  8: lbbs bbs_node_menuexec()
[2025-12-18 21:39:03.848]   ERROR[1943176]: backtrace.c:279 bbs_log_backtrace:  9: lbbs <unknown>()
[2025-12-18 21:39:03.849]   ERROR[1943176]: backtrace.c:279 bbs_log_backtrace: 10: lbbs bbs_node_handler()
[2025-12-18 21:39:03.851]   ERROR[1943176]: backtrace.c:279 bbs_log_backtrace: 11: lbbs <unknown>()
[2025-12-18 21:39:03.852]   ERROR[1943176]: backtrace.c:279 bbs_log_backtrace: 12: [0x7f84919351f5] libc.so.6                         pthread_create.c:442   start_thread()
[2025-12-18 21:39:03.854]   ERROR[1943176]: backtrace.c:279 bbs_log_backtrace: 13: [0x7f84919b58dc] libc.so.6                                 clone3.S:83    clone3()

Thread 51 (Thread 0x7f8437f8a6c0 (LWP 1943372) "lbbs"):
#0  0x00007f849197b545 in __GI___clock_nanosleep (clock_id=clock_id@entry=0, flags=flags@entry=0, req=req@entry=0x7f8437f896e0, rem=rem@entry=0x0) at ../sysdeps/unix/sysv/linux/clock_nanosleep.c:48
        sc_cancel_oldtype = 0
        sc_ret = <optimized out>
        r = <optimized out>
#1  0x00007f849197fe53 in __GI___nanosleep (req=req@entry=0x7f8437f896e0, rem=rem@entry=0x0) at ../sysdeps/unix/sysv/linux/nanosleep.c:25
        ret = <optimized out>
#2  0x00007f84919ab285 in usleep (useconds=<optimized out>) at ../sysdeps/posix/usleep.c:31
        ts = {tv_sec = 0, tv_nsec = 1000000}
#3  0x0000561b05b501d3 in __bbs_rwlock_wrlock (t=0x7f84910303b0 <queues+16>, filename=0x7f849102d00a "mod_asterisk_queues.c", lineno=188, func=0x7f849102dc58 <__func__.20> "del_agent", name=0x7f849102d08>
        diff = 2735
        res = 16
        c = 2541095
        now = 1766099004
        elapsed = 2735
        start = 1766096269
        __func__ = "__bbs_rwlock_wrlock"
#4  0x00007f8491027aa3 in del_agent (agent=0x7f847c1ebc50) at mod_asterisk_queues.c:188
        queue = 0x7f849102b657 <agent_exec+823>
        member = 0x7f8437f89880
        __func__ = "del_agent"
#5  0x00007f849102b7cc in agent_exec (node=0x7f84818c49b0, args=0x0) at mod_asterisk_queues.c:1203

Thread 41 (Thread 0x7f8430f7c6c0 (LWP 1943176) "lbbs"):
#0  0x00007f849197b545 in __GI___clock_nanosleep (clock_id=clock_id@entry=0, flags=flags@entry=0, req=req@entry=0x7f8430f7b6e0, rem=rem@entry=0x0) at ../sysdeps/unix/sysv/linux/clock_nanosleep.c:48
        sc_cancel_oldtype = 0
        sc_ret = <optimized out>
        r = <optimized out>
#1  0x00007f849197fe53 in __GI___nanosleep (req=req@entry=0x7f8430f7b6e0, rem=rem@entry=0x0) at ../sysdeps/unix/sysv/linux/nanosleep.c:25
        ret = <optimized out>
#2  0x00007f84919ab285 in usleep (useconds=<optimized out>) at ../sysdeps/posix/usleep.c:31
        ts = {tv_sec = 0, tv_nsec = 1000000}
#3  0x0000561b05b501d3 in __bbs_rwlock_wrlock (t=0x7f84910303b0 <queues+16>, filename=0x7f849102d00a "mod_asterisk_queues.c", lineno=188, func=0x7f849102dc58 <__func__.20> "del_agent", name=0x7f849102d08>
        diff = 2735
        res = 16
        c = 4606273
        now = 1766099004
        elapsed = 2735
        start = 1766096269
        __func__ = "__bbs_rwlock_wrlock"
#4  0x00007f8491027aa3 in del_agent (agent=0x561b280d4d60) at mod_asterisk_queues.c:188
        queue = 0x7f8430f7c6c0
        member = 0x1ffffffff
        __func__ = "del_agent"
#5  0x00007f849102b7cc in agent_exec (node=0x7f848c1b8f90, args=0x0) at mod_asterisk_queues.c:1203
        agentid = 378
        agent = 0x561b280d4d60
        tmp = 0x561b28171350 "378"
        __func__ = "agent_exec"
#6  0x0000561b05b44eea in bbs_door_exec (node=0x7f848c1b8f90, name=0x7f8430f7b960 "astqueue", args=0x0) at door.c:130

Comments

You must be logged in to leave a comment.