Skip to content

Windows: bun test --parallel worker segfaults (heap corruption seen in GC sweep, libuv pipe read on canary) in a suite that spawns child processes over pipes #44390

Open

Description

@code-yeongyu

What version of Bun is running?

1.4.2 (744846f)

What platform is your computer?

Windows x64 (GitHub Actions windows-latest, Windows 10.0.26100), CPU: sse42 popcnt avx avx2 avx512

What steps can reproduce the bug?

I do not have a minimal reproduction. A self-contained attempt (40 test files, each spawning a bun child that serves a named pipe, then connecting, echoing, destroying the socket and killing the child, run with bun test --parallel and no preload) ran 40 clean iterations on both 1.4.2 and 1.4.3-canary.1 on the same runner image.

What does reproduce is one directory of a public repository, looped on a windows-latest runner:

git clone https://github.com/code-yeongyu/oh-my-openagent
cd oh-my-openagent
git checkout f4ec0065cd8e2b623317b16abe56621c0672b694
bun install --frozen-lockfile
for ($i = 1; $i -le 25; $i++) {
  bun --config=bunfig.win2.parallel.toml test --parallel --timeout 30000 packages/senpi-task/src/runners/rpc-host
}

Each iteration runs 262 tests across 36 files, about 17 s on the runner. On 1.4.3-canary.1+4b02e1031 one of 25 iterations crashed. On 1.4.2 a 25-iteration loop happened to stay clean, but 1.4.2 crashed four times in the full suite these files belong to.

The crash shows up in a large repository suite run as bun test --parallel (about 1,060 files and 7,960 tests in that shard). The crashing worker was started by the coordinator as:

bun.exe test --test-worker --isolate --timeout=30000 --max-concurrency=20 --preload ./test-env.ts --preload ./test-setup.ts --loader .md:text --jsx-runtime=automatic

It reddens roughly one in five or six runs of that shard. A rerun of the same commit usually passes.

What is the expected behavior?

The worker finishes its files, or Bun reports an ordinary test failure.

What do you see instead?

The worker panics, the file it was running is reported as (worker crashed: exit code 3), and the shard fails:

panic(main thread): Segmentation fault at address 0xFFFFFFFF80070006
oh no: Bun has crashed. This indicates a bug in Bun, not your code.
✗ <test file> (worker crashed: exit code 3)

Four occurrences on 1.4.2 in the full suite, plus one on 1.4.3-canary.1 in the loop above, all on the same runner image and all in files of one directory. The worker had been running for 66 to 94 seconds, with RSS 0.34 to 0.39 GB:

Fault address Crash report
0x1 https://bun.report/1.4.2/wt1744846fiDgkggS4n+vH+4+4GmwpjBmyxsQ63vsQ06lsQ2p0yGsxyyGm60tfst22Hq771H2hsihB01j0H2pvEw8lEu0zBothm0DCYKERNEL32.DLLu40LCSntdll.dll4zijBA2AC
0x1 https://bun.report/1.4.2/wt1744846fiDgkggS4n+vH+4+4GmwpjBmyxsQ63vsQ06lsQ2p0yGsxyyGm60tfg8qihB01j0H2pvEw8lEu0zBothm0DCYKERNEL32.DLLu40LCSntdll.dll4zijBA2AC
0xFFFFFFFF80070006 https://bun.report/1.4.2/wt1744846fiLgsggSm2rwsCkt3sQih84GmwpjBkoojB+npiBw/4xEgnzxEg1xxEq6wxE8yvxEysuxE69sxEo9lxEs6ixEs6ixEs6ixEs6ixEs6ixE4q+wEA2D1//j//D
0x24 https://bun.report/1.4.2/wt1744846fiDgkggSCSntdll.dllmo1CCSntdll.dllknsDm+gpPCSntdll.dllk2wb
0x0 (1.4.3-canary.1+4b02e1031) https://bun.report/1.4.3/wt24b02e10iDgkggS28/jB64+jBo6/uP8yw1Pgx44G6904Gu/tzGgl16H2oxm7Bmn54HwgyE4hoEutxBo8lg3DCYKERNEL32.DLLu40LCSntdll.dll4zijBA2AA

Remapped through bun.report/remap, the first three are a GC sweep destroying a cell whose refcounted member is already garbage:

  • 0x1 (twice): WTF::ThreadSafeRefCounted<JSC::WatchpointSet>::deref <- HashMap<int, RefPtr<WatchpointSet>>::~HashMap <- JSC::StructureRareData::~StructureRareData <- MarkedBlock::Handle::sweep <- IncrementalSweeper::doWork <- JSRunLoopTimer <- WTFTimer__fire <- VirtualMachine::auto_tick <- test::parallel::runner::WorkerLoop::begin
  • 0xFFFFFFFF80070006: WTF::ThreadSafeRefCounted<WTF::MetaAllocatorHandle>::deref <- MacroAssemblerCodeRef::~MacroAssemblerCodeRef <- DFG::JITData::~JITData <- JSC::CodeBlock::~CodeBlock <- MarkedBlock::Handle::sweep <- LocalAllocator::allocateSlowCase <- ModuleProgramCodeBlock::create <- JSModuleRecord::evaluate (the worker was loading the next test file)
  • 0x24: frames are only in ntdll.dll.
  • 0x0 on canary: uv__queue_remove <- uv_timer_stop <- uv_timer_start <- eof_timer_start (win/pipe.c:2418) <- uv__pipe_queue_read <- uv__process_pipe_read_req (win/pipe.c:2232) <- uv__process_reqs <- uv_run <- WindowsLoop::tick_with_timeout <- EventLoop::auto_tick <- test::parallel::runner::WorkerLoop::begin. A pipe read completion is processed for a pipe whose timer state is already gone, which looks like the source of the corruption the 1.4.2 sweeps trip over.

Additional information

Activity

  1. changed the title [-]Windows: bun test v1.4.2 (744846f84) 14x PARALLEL worker segfaults (heap corruption seen in GC sweep, libuv pipe read on canary) in a suite that spawns child processes over pipes[/-] [+]Windows: `bun test --parallel` worker segfaults (heap corruption seen in GC sweep, libuv pipe read on canary) in a suite that spawns child processes over pipes[/+] on Oct 1, 2026
  2. added
    bun:testSomething related to the `bun test` runner
    crashAn issue that could cause a crash
    windowsAn issue that is known to occur on Windows
    on Oct 1, 2026
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

    bun:testSomething related to the `bun test` runnercrashAn issue that could cause a crashwindowsAn issue that is known to occur on Windows

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions