Skip to content

[Web] Socket listeners & component event handlers never cleaned up #386

@Flegma

Description

@Flegma

Summary

Global socket listeners and component-level event handlers are created but never properly removed.

Findings

  • Socket.ts — 5 global socket listeners registered at module load. Return values (.stop() methods) never captured.
  • ChatLobby.vue — watch on lobbyId assigns new listener without calling .stop() on previous.
  • MatchmakingConfirm.vue — countdownInterval may not be cleared if error occurs before unmount.
  • StreamGlobal.vue — document event listeners added on mount without duplicate check.

Impact

Accumulated listeners cause duplicate event processing and memory growth.

Suggested Fix

Capture and store all listener return values. Call .stop() on previous before creating new. Clear intervals in error paths.


Related Issues (Memory Leak Pattern)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1-highStability & reliabilityaudit-2026-03From March 2026 codebase auditmemory-leakMemory or subscription leakservice:web5stackgg/web service

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions