Skip to content

Potential Memory Leak in TanStack Start with SSR Streaming #5289

@jlucaso1

Description

@jlucaso1

Which project does this relate to?

Start

Describe the bug

When a TanStack Start application is put under load, its memory usage grows linearly with each request that involves SSR streaming of a component. This eventually leads to performance degradation, connection errors, and server crashes.
The issue seems specific to SSR-rendered pages. Pure API routes (e.g., a GET handler returning a simple response) do not exhibit the same memory growth. We have been able to reproduce this behavior on the Bun runtime.

Your Example Website or App

https://github.com/TanStack/router/tree/main/examples/react/start-bun

Steps to Reproduce the Bug or Issue

cd start-bun
bun install
bun run build && bun run start
oha "http://localhost:3000/" -c 100 -n 10000

While the test is running, observe the server's memory usage using a tool like htop or your system's activity monitor.

Expected behavior

The server's memory usage should remain stable and relatively low throughout the load test. The test should complete with a very high success rate (>99%) and minimal connection errors.

Screenshots or Videos

Screencast_20250928_223925.mp4

Platform

  • Router / Start Version: Start: 1.132.24; Router: 1.132.23
  • OS: Linux
  • Browser: Chrome
  • Browser Version: 140
  • Bundler: vite
  • Bundler Version: 7.1.7

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions