Repository navigation
Run PGlite unit tests in separate processes on Linux - #393
Merged
Merged
Conversation
Node 24 on Linux can abort with a V8 fatal check in ThreadIsolation::UnregisterWasmAllocation while it frees PGlite's Wasm code after a file finishes in a worker thread. The abort kills the shared Vitest process, so CI shows no summary and no failing test. The API integration project already uses forks on Linux for this reason. Move the five PGlite files out of platform-unit into a sibling platform-unit-pglite project with the same Linux forks pool, and keep the other platform unit files on threads. CI's --project 'platform-unit*' selects both projects, and a config test keeps any new PGlite unit file in the new project. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
🚀 Deploying Preview to Cloudflare 🚀Preview URL: https://fix-platform-unit-flake-void-cloud.voidzero-docs.workers.dev (commit a9ba8c0)This URL reflects your latest Preview deploymentPreview Deployments by commit
|
Brooooooklyn
added a commit
that referenced
this pull request
Oct 8, 2026
## Problem The CI `test (ubuntu-latest, unit)` job can die on Linux with exit code 132, and no test fails. This is the same Node 24 V8 abort that #393 fixed for `platform-unit`: ``` # Check failed: jit_page_->allocations_.erase(addr) == 1. v8::internal::ThreadIsolation::UnregisterWasmAllocation Process completed with exit code 132. ``` ``` unit (pool: threads, one process) ├─ worker: platform-database-lock.test.ts (PGlite) finishes │ └─ V8 frees its Wasm code ──► fatal check ──► SIGILL └─ whole Vitest process dies ──► 107–130 of 382 files never report ``` The SDK `unit` project runs 4 PGlite files in worker threads: - `packages/void/test/unit/db-export-roundtrip.test.ts` - `packages/void/test/unit/platform-database-lock.test.ts` - `packages/void/test/unit/platform-database-migrations.test.ts` - `packages/void/test/unit/runner-pg.test.ts` Seen twice on Oct 8, both with `vp test run --project unit --project cli-unit` on Node 24.21.0: | run / job | abort | last PGlite file done before it | | --- | --- | --- | | 37722871396 / 113134327555 | 03:30:30 | `platform-database-lock` (2.5 s before) | | 37723925583 / 113137655099 | 03:43:48 | `runner-pg` (8.6 s before) | No other Wasm runs in that job. `cli-unit` has no PGlite file. The SDK integration PGlite test already runs in forks. ## Fix Move the 4 files into a new project, `unit-pglite`. It uses forks on Linux and threads on other platforms. All other options match `unit`: the scheduling group, the worker limit, and the Windows timeout. ``` before: unit (threads) ── 382 files, PGlite included after: unit (threads) ── 378 files unit-pglite ── 4 PGlite files, forks on Linux ``` - These places now name `unit-pglite`: the CI unit shard, `test:unit`, the affected runner's `--unit` list, and `TESTING.md`. - The existing "every SDK unit file exactly once" test now includes `unit-pglite`. - The PGlite placement check that #393 added to `test-projects.test.ts` is removed. It tested the test configuration, not product behavior. - The test bodies do not change. ## Testing - `vp test run --project unit --project unit-pglite --project cli-unit` (the CI command): 394 files, 7585 tests passed. - `vp test run --project unit-pglite --pool forks`: 4 files, 28 tests passed. - `vp test list`: the 4 files are only in `[unit-pglite]`, and no file runs twice. - With the platform faked: Linux selects forks for `unit-pglite`, and macOS and Windows select threads. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
test (platform-unit)sometimes dies on Linux with exit code 132, and no test fails. Node 24's V8 aborts while it frees PGlite's WebAssembly code in a worker thread:platform-unitruns every file as a worker thread in one Vitest process. When one thread hits this V8 check, the whole process dies. Five platform unit files start PGlite.bffa88e28fixed the same abort for the API integration project: it runs those files in forks on Linux. That fix did not cover the PGlite files inplatform-unit.Seen on Oct 8:
github-authority-migration.test.tsfinished, with three PGlite files not yet reported.Fix
Move the five PGlite files into a new project,
platform-unit-pglite. It uses forks on Linux and threads on other platforms. The other 138 platform unit files stay on threads.--project 'platform-unit*', so it selects both projects.vp run test --unit(test/affected.mjs) andtest:platform(platform-*) include the new project.platform-unit-pglite.The crash does not reproduce on demand. In Linux Docker with Node 24.21.0, a standalone script ran more than 3,000 PGlite worker teardowns and did not abort. The fix follows where the CI crashes happened and the earlier fix in
bffa88e28.Testing
vp test run packages/void/test/unit/test-projects.test.ts: 5 passed.vp test run --project 'platform-unit*': 143 files, 2701 tests passed.platform-unit-pgliteon forks. macOS and Windows keep threads.🤖 Generated with Claude Code