Skip to content

Segfault after ~24h idle on Windows 11 with sleep/wake cycles #28175

Open

Description

@ElliotDrel

Environment

  • Bun v1.3.11 (a2743b6)
  • Windows 11 Pro 10.0.26200
  • Windows x64 (baseline), CPU: sse42 avx avx2
  • Machine RAM: 16.92GB

Crash Report

  • Elapsed: 84520518ms (~23.5 hours)
  • RSS: 0.92GB | Peak: 0.92GB | Commit: 4.84GB | Faults: 3614798
  • Segmentation fault at address 0x5CA6C010000
  • Stack involves KERNEL32.DLL and ntdll.dll

Reproduction

  • Running a long-lived CLI process built as a Bun standalone executable
  • Process was idle for ~24 hours
  • Laptop went through multiple sleep/wake cycles during that period
  • Had 5 concurrent Bun processes running; 2 of 5 crashed with identical segfault signatures
  • 3 of 5 sessions survived, suggesting a race condition or timing-dependent issue

Crash Link

https://bun.report/1.3.11/e_1a2743b6mgggEuhogCgs2hyCmj2hyCm/0hyCs6xhyCwsho3BimhoGikx1do++sf0y5wMmvw9U8839Uotqx1B8ll11Biw2n4Bqixj4B68uj4Bu754W4glvRCYKERNEL32.DLLut0LCSntdll.dll4oijBA208CgggkgsD

Notes

The crash likely relates to how Bun handles OS suspend/resume. Network connections, timers, or memory-mapped regions may become invalid after wake and aren't being recovered gracefully. The high page fault count and commit charge suggest memory pressure may compound the issue.

Activity

  1. github-actions commented on Mar 17, 2026

    @github-actions
    Contributor

    Found 3 possible duplicate issues:

    1. Seg fault on windows sleep -> wake #24804
    2. Bun crash on Windows after standby with running session #23399
    3. Crash after wakeup #18352

    This issue will be automatically closed as a duplicate in 3 days.

    • If your issue is a duplicate, please close it and 👍 the existing issue instead
    • To prevent auto-closure, add a comment or 👎 this comment

    🤖 Generated with Claude Code

  2. ElliotDrel commented on Mar 18, 2026

    @ElliotDrel
    Author

    This bug has been reported and closed repeatedly without a fix since at least Bun v1.2.5:

    It is still present in v1.3.11. Each time the issue gets closed (often by a dedupe bot), but the underlying crash on Windows sleep/wake has never been addressed. This should be kept open until there's an actual fix.

    A second crash instance with a different fault address and bun.report link was filed in #28176 (now closed as duplicate of this issue) — the crash data there may still be useful for diagnosis.

  3. ElliotDrel commented on Mar 31, 2026

    @ElliotDrel
    Author

    Another crash on the same machine. This one occurred after ~3 hours of active use (not idle/sleep-wake like the original report), suggesting the root cause isn't limited to suspend/resume.

    Bun v1.3.11 (759ce802) Windows x64 (baseline)
    Windows v.win11_dt
    CPU: sse42 avx avx2
    
    Elapsed: 10624516ms | User: 65781ms | Sys: 21375ms
    RSS: 1.36GB | Peak: 1.36GB | Commit: 3.27GB | Faults: 1613815 | Machine: 16.92GB
    
    panic(thread 26956): Segmentation fault at address 0x353E2010000
    

    Crash report: https://bun.report/1.3.11/e_1759ce80mgggEuhogCgor9wCmgr9wCm8p9wCs3m9wCw5ox3Bi80hNir0wkBo5iomB006qTmhy4b8u54bo3++0B8m5iwBixt+2Bqjo62B69l62Bu26zd4p/pYCYKERNEL32.DLLut0LCSntdll.dll4oijBA2m1Bhgg8/d

    Same high-address segfault pattern as the original two crashes (0x5CA6C010000, 0x44924010000). All three share KERNEL32.DLL/ntdll.dll in the stack. This is now the third instance on this machine across different session durations.

  4. ElliotDrel commented on Apr 6, 2026

    @ElliotDrel
    Author

    Are PRs #28230 (Windows bmalloc/GC crash fix) and #28026 (MimallocArena heap tag fix) related to this? Both touch Windows memory management paths that could explain the segfault pattern reported here. Happy to test a canary build if either lands.

  5. JoshSalway commented on Apr 10, 2026

    @JoshSalway

    Additional crash data from v1.3.11 (Windows 11 Pro x64)

    Hit the same crash pattern after ~25 hours of continuous use as a Claude Code standalone executable.

    Runtime stats at crash:

    • RSS: 2.57GB | Peak: 2.60GB | Commit: 3.66GB
    • Page faults: 4,827,244
    • Machine: 66.17GB total RAM
    • Features: 812 fetch calls, standalone_executable
    • Elapsed: ~25 hours wall clock

    Encoded crash data:

    1.3.11/e_187b3dffmgggEuhogCukp33Bi76hNijiykBok5pmB0ovrTmp8ma2/o7booyl1Bwn+mwBinuk3Bq5og3B6zmg3Buih2d4uvsYCYKERNEL32.DLLut0LCSntdll.dll4/hjBA20wChgg8rnB
    

    Decoded stack trace:

    _mi_memcpy (mimalloc internal.h:985)
    Allocator remap (Allocator.zig:371)
    array_list grow (array_list.zig:975)
    handle_oom (handle_oom.zig:53)
    AsyncHTTP callback (AsyncHTTP.zig:397)
    HTTP response processing (http.zig:2019)
    OpenSSL (openssl.c:575)
    libuv event loop (loop.c:519, core.c:613)
    HTTPThread (HTTPThread.zig:534)
    

    The crash is in mi_realloc_aligned's internal _mi_memcpy during HTTP response body buffer growth. The segfault address (0x50AD8A10000) follows the same high-address pattern as the other reports in this issue.

    After tracing the code path, this appears to be the MimallocArena heap tag collision described in #28026. Arena heaps created with mi_heap_new() use tag 0 (same as the backing heap), so abandoned pages from dead threads get adopted by the wrong heap and their live blocks get freed, corrupting the free-list.

    Would the fixes in #28026 and #28230 address this? Happy to test a canary build if either lands.

  6. ElliotDrel commented on Apr 18, 2026

    @ElliotDrel
    Author

    @dylan-conway — Following up on @JoshSalway's root cause analysis above. The decoded stack trace points to mi_realloc_aligned crashing due to MimallocArena heap tag collision: arena heaps from mi_heap_new() use tag 0 (same as backing heap), so abandoned pages from dead threads get adopted by the wrong heap, corrupting the free-list.

    PR #28026 appears to address exactly this. There are 6+ duplicate issues across 2+ years (#18352, #23180, #23399, #24804, #20710, #26984) — all closed without fix. This affects long-lived processes on Windows (Claude Code, CI tools, daemons) and is deterministically reproducible after ~24h.

  7. ElliotDrel commented on May 2, 2026

    @ElliotDrel
    Author

    Checking in again — it's been two weeks since the root cause analysis. The decoded stack trace makes this pretty actionable (MimallocArena heap tag collision in mi_realloc_aligned). Is anyone looking at this? Happy to test a fix build whenever one's available.

  8. ElliotDrel commented on May 18, 2026

    @ElliotDrel
    Author

    @dylan-conway — following up again. It's now been 9+ weeks since @JoshSalway decoded the root cause (MimallocArena heap tag collision in mi_realloc_aligned) and two fix PRs were filed (#28026, #28230). This affects Claude Code users on Windows specifically — there are 6+ duplicate reports in the anthropics/claude-code repo with the same crash signature. Is there a timeline for this getting reviewed? Happy to test a canary build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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