Fix the dev-db socket test wedge: bind conflicts hung server.start() - #1853
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
executor-marketing | a3ed588 | Commit Preview URL Branch Preview URL |
Aug 29 2026, 09:16 AM |
Contributor
Cloudflare previewTorn down — the PR is closed. |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
executor-cloud | a3ed588 | Aug 29 2026, 09:17 AM |
@executor-js/cli
@executor-js/config
@executor-js/execution
@executor-js/sdk
@executor-js/codemode-core
@executor-js/runtime-quickjs
@executor-js/plugin-file-secrets
@executor-js/plugin-graphql
@executor-js/plugin-keychain
@executor-js/plugin-mcp
@executor-js/plugin-onepassword
@executor-js/plugin-openapi
executor
commit: |
RhysSullivan
marked this pull request as ready for review
August 29, 2026 18:33
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.
Symptom
The dev-db PGlite socket tests were the loudest CI flake. Different tests in
apps/cloud/src/db/dev-db-socket-concurrency.node.test.tsdied as bare vitesttimeouts (30s/60s) across main and PR branches — five wedges in the last two
days alone — and
test-globalsetup-exit.node.test.tsflaked alongside them.The wedges never carried diagnostics, and hundreds of local replays never
reproduced one.
Mechanism
The tests bound fixed ports 45993-45998, and the globalsetup meta-test used
45435/45436. All of these sit inside the default Linux ephemeral port range
(32768-60999). On a busy CI runner another socket can hold one of them at bind
time: an outbound connection from a sibling suite in the same turbo shard, or
a leaked e2e server (the e2e harness's own port code documents this exact
contention for its 42000-45999 block).
When that happened, the bind failure vanished: pglite-socket's
start()setsactive = truebeforelisten(), and its error handler only rejected thestart promise while
activewas false. EADDRINUSE therefore dispatched anerrorevent nobody listened to, andawait server.start()never settled.The test then died at its vitest timeout with zero output — before reaching
the wedge diagnostics added in #1767. The meta-test variant: the nested vitest
run hung the same way until
spawnSync's timeout killed it (signal !== null).macOS assigns ephemeral ports from 49152, so the collision was impossible
locally on a Mac — matching the "CI-only, any test, no diagnostics" shape of
every occurrence.
Fix
patches/@electric-sql%2Fpglite-socket@0.1.4.patch):start()nowalways rejects on a server error. A settled promise ignores later rejects,
so post-listen errors still surface only through the
errorevent.server's
listeningevent.suite keeps 5434, which is outside the contested range.
start()instead of hanging.is in the query queue.
No changeset: the patch and tests only affect the repo-local dev/test
topology.
pglite-socketconsumers here are the root package, the privatecloud app, and
runtime-dynamic-worker(changeset-ignored).Proof
the exact CI signatures deterministically — interleave test "timed out in
60000ms", idle-backstop test "timed out in 30000ms", all other tests green.
runs of both files; one green run under 2x-CPU-count busy-loop load with all
eight legacy ports squatted; full
apps/cloudsuite green (50 files, 359tests).
idle Linux box all passed on the old code, confirming the wedge needs port
contention, not load.