@tailwindcss/oxide segfaults when a process holds more than one Scanner (4.3.3, 4.3.5, linux-x64-gnu)
What version of Tailwind CSS are you using?
@tailwindcss/oxide 4.3.5 (also 4.3.3), native @tailwindcss/oxide-linux-x64-gnu binding.
What build tool (or framework if it abstracts the build tool) are you using?
Seen first with @tailwindcss/vite 4.3.3 under Vitest 5. It reproduces with @tailwindcss/oxide alone in plain Node; see below.
What version of Node.js are you using?
v26.12.0. The crash also happens with other Node 26 builds.
What browser are you using?
N/A
What operating system are you using?
Arch Linux, x86_64, kernel 7.2, glibc
Reproduction URL
Self-contained script below, run against apps/web of https://github.com/pingdotgg/t3code (commit 7a64505a21e755498e6b85794124f3754265db38).
Describe your issue
When a process creates more than one Scanner and calls scan() on them, it intermittently dies with SIGSEGV, or sometimes SIGABRT. A single Scanner never crashed in 15 runs, even with repeated scan() calls. With 3 scanners × 3 rounds, about 1 run in 4 crashes.
git clone --depth 1 --filter=blob:none --sparse https://github.com/pingdotgg/t3code.git
git -C t3code sparse-checkout set apps/web
mkdir oxide-repro && cd oxide-repro && npm init -y && npm i @tailwindcss/[email protected]
cat > scan.cjs <<'JS'
const [base, n, rounds] = process.argv.slice(2);
const { Scanner } = require("@tailwindcss/oxide");
const scanners = Array.from({ length: +n }, () =>
new Scanner({ sources: [{ base, pattern: "**/*", negated: false }] }));
for (let r = 0; r < +rounds; r++) for (const s of scanners) s.scan();
console.log("ok");
JS
for i in $(seq 1 15); do node scan.cjs ../t3code/apps/web 3 3 >/dev/null 2>&1; echo -n "$? "; done; echo
# typical output: 0 139 0 0 0 139 0 139 0 0 139 0 0 0 0
# with n=1 (one scanner): all 0
In real use, @tailwindcss/vite creates one scanner per Vite server. A Vitest workspace with several projects that share a Vite config therefore holds several scanners in one process, and the whole test run segfaults.
From core dumps (4.3.3, no symbols available): the faulting thread is a rayon worker inside the oxide binding. Its stack is a deep repeating join/bridge recursion that ends in a byte load through an invalid pointer (movzbl -0x2(%r8,%rbp,1) with r8 = 0x3). A second rayon worker was in the same routine. Other crashes jumped to address 0x0. That pattern suggests memory corruption rather than a plain panic.
Our workaround is to avoid creating more than one scanner per process: we stopped Vite's server.warmup from loading CSS under Vitest.
Thanks for the detailed report. The core dump details helped a lot.
We can't reproduce this on macOS with 4.3.5, not even with Guard Malloc or the extractor's debug checks on. So we looked at the faulting instruction in the 4.3.3 linux-x64-gnu binary instead:
- The load at
0x20a342(movzbl -0x2(%r8,%rbp,1)) goes through the cursor's input pointer. The function copies that pointer to the stack at0x20a173. - At
0x20a19c, it reads that stack slot back and dereferences it without problems. - About 25 instructions later, at
0x20a2fd, it reads the same slot again and gets0. That's wherer8 = 0x3comes from. - There's no call and no store to that slot in between. So the thread didn't overwrite its own value: something outside the thread's code changed that memory.
That's the same signature as https://github.com/BurntSushi/ripgrep/issues/3494. There, on Linux 7.0, a thread writes to a freshly faulted page, and a few instructions later the value reads back as 0 while another thread unmaps memory. It was traced to a kernel race that a 7.0 change to page table reclaim made more likely (https://github.com/torvalds/linux/commit/4c640eb4181cf8de74c8b9e7c9cf16bf8d26b73e). It would also fit your other crashes: a zeroed return address jumps to 0x0, and zeroed malloc metadata ends in SIGABRT.
A candidate kernel fix (https://github.com/torvalds/linux/commit/478a1c3abebfc717db0d1281a9cdd7befafee542) is in 7.1.9 and 7.2. If you run a 7.2 release, you already have it, so either it doesn't cover this case or the cause is something else. Its commit message also says AMD CPUs are the most exposed.
The number of scanners may be a red herring. Only the first scan() of each Scanner runs the extractor, because later calls skip files whose mtime didn't change. So 3 scanners run the extractor 3 times per process, and 1 scanner runs it once.
Could you help us narrow it down?
- Share the output of
uname -rand your CPU model (lscpu | grep 'Model name'). - Run the same loop on an older kernel, for example Arch's
linux-ltspackage. If it never crashes there, this is a kernel bug and not something we can fix in Tailwind. - If it still crashes on the LTS kernel, try Node 24 as well, so we can rule out Node 26.
Sent by an AI assistant on behalf of @RobinMalfait.