Skip to content

[Web] GraphQL subscription leaks — NotificationStore, ApplicationSettings, Matchmaking, MatchLobby #385

@Flegma

Description

@Flegma

Summary

Multiple Pinia stores create GraphQL subscriptions that are never unsubscribed, causing memory leaks that grow over the session lifetime.

Findings

  • NotificationStore — three subscriptions in subscribeToAll() never stored for cleanup. Called multiple times on auth changes.
  • ApplicationSettings — setInterval created inside subscription callback. New interval on every settings update without clearing old ones.
  • MatchmakingStore — subscribeToFriends, subscribeToMatchInvites, subscribeToLobbies called on auth changes via watch, old subscriptions never cleaned up.
  • MatchLobbyStore — all subscription methods called from AuthStore but never returned or stored for cleanup.

Impact

Memory and connection usage grows with each auth state change. Long sessions accumulate hundreds of active subscriptions.

Suggested Fix

Create a useSubscriptionManager() composable that stores subscription references, auto-unsubscribes previous on same key, and provides cleanup on logout/unmount.


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