Skip to content

Memory leak freezes app when changing routes while remote queries are in flight #15068

@mgrubinger

Description

@mgrubinger

Describe the bug

Here's my fictional setup:

  • 3 routes:

    1. three individual boundaries, each with the same component (different props) which in turn loads data via remote query()
    2. same components with same props, but wrapped in just one boundary
    3. simple no-data route for testing
  • remote query function is artificially delayed by 2 seconds

When I navigate to the first page, wait for all 3 queries to resolve, then switch to the second route, the data is not fetched again. This seems to be as designed, remote queries are cached.

However, if I visit the first route (with 3 boundaries), then – while the requests are still in flight – switch to the second route (just one boundary, but same components/same props) the page freezes, the DOM count and memory usage (as visible in performance monitor panel in devtools) explodes and the requests never resolve.

This happens in devmode and production/preview

Reproduction

https://github.com/mgrubinger/sveltekit-remote-functions-freeze

the index route will also outline the steps to reproduce the issue. make sure to open performance monitor panel in devtools before causing the issue.

Logs

System Info

System:
    OS: macOS 15.6.1
    CPU: (8) arm64 Apple M3
    Memory: 188.86 MB / 24.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 25.0.0 - /Users/mg/.nvm/versions/node/v25.0.0/bin/node
    npm: 11.6.2 - /Users/mg/.nvm/versions/node/v25.0.0/bin/npm
    pnpm: 10.10.0 - /Users/mg/Library/pnpm/pnpm
  Browsers:
    Brave Browser: 143.1.85.116
    Chrome: 143.0.7499.41
    Chrome Canary: 145.0.7578.0
    Firefox: 145.0.2
    Firefox Nightly: 146.0a1
    Safari: 26.1
  npmPackages:
    @sveltejs/adapter-auto: ^7.0.0 => 7.0.0
    @sveltejs/kit: ^2.49.2 => 2.49.2
    @sveltejs/vite-plugin-svelte: ^6.2.1 => 6.2.1
    svelte: ^5.46.0 => 5.46.0
    vite: ^7.2.2 => 7.3.0

Severity

serious, but I can work around it

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions