WhatBrokeToday
FAQ
Today's Trends
mediumInvestigatingBun

Bun Garbage Collection Leaks Dead Array References in Suspended Async Frames

  1. Investigating(current)
  2. Trending(upcoming)
  3. Workaround available(upcoming)
  4. Resolved(upcoming)

Executive summary

A WeakRef target with no strong references remaining unexpectedly survives multiple full garbage collections in suspended async frames on Windows and Linux. The issue is tied to conservative roots in optimizing JIT frames and disappears or shifts when JIT is disabled.

No verified workaround yet

None of the linked reports describe a mitigation. Follow this incident to hear when one appears.

Official fix
Technical root cause

Conservative roots retain dead slots in optimizing JIT frames during garbage collection runs in suspended async functions.

Evidence

1 report · 1 GitHubShow
  1. [1]
    GitHub First report
    A dead 1.9 MB Array survives 14 full collections from conservative roots in suspended async frames (attempt 167 on Windows and Linux; JIT-dependent survivors vanish with useJIT=0)(opens GitHub issue in a new tab)

    What is the problem? A WeakRef target with no strong reference left survives 14 full collections (Bun.gc(true)) in the same shape on Windows and Linux. Two attempt numbers retain on Windows (2 and 167 of 2,000); on Linux, 167 retains in every run and attempts 1–4 also retain in the JIT-on runs, while with the optimizing JIT off exactly one attempt (1) still retains in 3 of 3 runs. So there are two conservative roots in one shape: a dead slot in an optimizing JIT frame, and — at least on Linux…

    by mq1n 0upvotes 2comments

Timeline

  1. First report on GitHub issue

    A dead 1.9 MB Array survives 14 full collections from conservative roots in suspended async frames (attempt 167 on Windows and Linux; JIT-dependent survivors vanish with useJIT=0)

    Source