fix(calls): lift CallControl's listener limit so ended calls can be freed (#316) #379

Merged
jared merged 1 commits from fix/call-listener-limit into lotus 2026-10-17 21:19:13 -04:00
Owner

Fixes #316.

More than 10 call features subscribe to CallControl's state_update at once: the call bar, controls, hotkeys, AFK, muted-talk, join/leave sounds, announcements, rejoin, the policy toast, the glance, and the desktop thumbbar/SMTC. At the default limit, Node's events logged a MaxListenersExceededWarning, and the console kept the warning's emitter alive. That emitter is the CallControl, and through it the whole Element Call document: about 11 MB per call, per the audit.

Change: setMaxListeners(100). These are real listeners that unsubscribe on cleanup, not a leak.

Not reproduced here: headless web logs no warning, likely because there are fewer subscribers without the desktop hooks. This is the fix the issue measured: swallowing the warning freed every CallControl, and the heap levelled off. Worth confirming on the desktop app.

tsc clean · unit tests pass · ESLint clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5

Fixes #316. More than 10 call features subscribe to `CallControl`'s `state_update` at once: the call bar, controls, hotkeys, AFK, muted-talk, join/leave sounds, announcements, rejoin, the policy toast, the glance, and the desktop thumbbar/SMTC. At the default limit, Node's `events` logged a **MaxListenersExceededWarning**, and the console kept the warning's emitter alive. That emitter is the `CallControl`, and through it the whole Element Call document: **about 11 MB per call**, per the audit. **Change:** `setMaxListeners(100)`. These are real listeners that unsubscribe on cleanup, not a leak. **Not reproduced here:** headless web logs no warning, likely because there are fewer subscribers without the desktop hooks. This is the fix the issue measured: swallowing the warning freed every `CallControl`, and the heap levelled off. Worth confirming on the desktop app. `tsc` clean · unit tests pass · ESLint clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
jared added 1 commit 2026-10-17 18:57:26 -04:00
fix(calls): lift CallControl's listener limit so ended calls can be freed (#316)
CI / Build & Quality Checks (pull_request) Successful in 3m16s
CI / Trigger Desktop Build (pull_request) Skipped
CI / Docker image build & smoke test (pull_request) Skipped
CI / Secret scan (gitleaks) (pull_request) Successful in 9s
CI / Playwright smoke (e2e) (pull_request) Successful in 18m30s
46d6570df3
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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
jared merged commit bb2ace82eb into lotus 2026-10-17 21:19:13 -04:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: LotusGuild/cinny#379