From 46d6570df3f6685430dc746586b08211b87e9dfd Mon Sep 17 00:00:00 2001 From: Lotus CI Date: Sat, 17 Oct 2026 18:57:22 -0400 Subject: [PATCH] fix(calls): lift CallControl's listener limit so ended calls can be freed (#316) More than 10 call features subscribe to CallControl's state_update at once (call bar, controls, hotkeys, AFK, muted-talk, join/leave sounds, announcements, rejoin, policy toast, glance, desktop thumbbar/SMTC). At the default limit Node's events logged a MaxListenersExceededWarning, and the console kept the warning's emitter (this CallControl, and through it the whole Element Call document) alive: ~11 MB per call per the audit. setMaxListeners(100); these are real, unsubscribed-on-cleanup listeners. Not reproduced in this environment (headless web logs no warning: fewer subscribers without the desktop hooks); this is the fix the issue measured (swallowing the warning freed all CallControls). Fixes #316 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5 --- src/app/plugins/call/CallControl.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/app/plugins/call/CallControl.ts b/src/app/plugins/call/CallControl.ts index da734785c..c37efc26b 100644 --- a/src/app/plugins/call/CallControl.ts +++ b/src/app/plugins/call/CallControl.ts @@ -91,6 +91,13 @@ export class CallControl extends EventEmitter implements CallControlState { constructor(state: CallControlState, call: ClientWidgetApi, iframe: HTMLIFrameElement) { super(); + // [Gitea #316] More than 10 call features subscribe to state_update at once + // (call bar, controls, hotkeys, AFK, muted-talk, join/leave sounds, + // announcements, rejoin, policy toast, glance, desktop thumbbar/SMTC …). + // Hitting the default limit logged a MaxListenersExceededWarning, and the + // console then kept this CallControl — and through it the whole Element Call + // document — alive: ~11 MB leaked per call. These are not leaks, so lift it. + this.setMaxListeners(100); this.state = state; this.call = call;