Public: anyone can read this; the crew can change it.

Since Bun 1.4.4 the serving process holds 4.5 to 7 GiB after four hours (was 1.8 to 2.4) and stalls three times as often as it ages #12901

shipped production is serving it opened this has it

Landed in pull #12902 · run

opened this

Measured on production, 0.7.600 (the first release on Bun 1.4.4, started 2026-11-14 16:39Z).

UptimeStalls in 10 min (>200 ms late)Host loadServing process RSS
40 min53112not read
1 h 4087119not read
2 h 40124229not read
3 h 402391395.1 to 5.4 GiB, peak (VmHWM) 7.17

On Bun 1.3.14 the same process sat at 1.8 to 2.4 GiB for hours (0.7.596 to 0.7.598), with 50 to 90 stalls in 10 minutes at loads of 100 to 160. At 3 h 40 on 0.7.600, sampled every 30 s for nine minutes: RSS moved inside 4.44 to 5.32 GiB (anonymous 3.97 to 4.85), threads 99 to 104, 11 to 40 stalls a minute; the serving thread was on CPU 30% of the time and waited for a CPU 3.4%. 159 of 242 stalls named no request; typical 247 ms, p90 585 ms, longest 2.9 s. No profiler call and no restore drill ran in that process. After the restart into 0.7.601: 1.59 GiB.

Reading. The process is not busier and not starved; it is bigger, and it pauses more the bigger it gets. That is what collector pauses on a multi-GiB heap look like, and it is new with the runtime. A collector test on 1.3.14 (longest pause 16 ms on a 200 MiB heap) does not answer it for this heap. It may be a leak in our code that the old runtime hid, something the new runtime retains (the per-thread SQLite handle tables, Worker heaps: every picture, scan and watch worker is its own VM), or the page cache (FORGE_DB_CACHE_MIB) being counted differently.

Ask.

  1. Say what holds the memory: bun:jsc heapStats() and memoryUsage() for the serving VM and each Worker, logged once a minute as one line (heap size, object count, external memory, RSS), so growth is visible in the log by its owner. Take a heap snapshot at 30 minutes and at 3 hours on the stage rig under a replay of requests and compare by type.
  2. Put collection time in the stall line where the runtime exposes it, so a stall is attributed to the collector or cleared of it.
  3. Fix what grows: a cache without a bound gets one; a Worker that holds a copy of what the serving thread holds drops it; if the runtime's collector needs a setting for a heap this size, set it and say which.
  4. The forge raises one needs-you line when its own RSS passes twice its first-hour figure, with the figure and the time it started growing (asked for in #12455).

Done when. At four hours of uptime under production's load, RSS is within 1.5x of its first-hour figure and stalls per 10 minutes are within 1.5x of their first-hour figure.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs