From 6c9b53ae1908eb32816d57f1af66c2a09d627aed Mon Sep 17 00:00:00 2001 From: Joseph Mearman Date: Mon, 14 Sep 2026 07:27:53 +0100 Subject: [PATCH] test(bridge): widen blockPort's EADDRINUSE retry window The prior 5-attempt/50ms budget (~250ms total) still wasn't always enough against a genuinely sustained ephemeral-port collision on a loaded CI runner -- two separate mutation-testing dry runs hit an uncaught EADDRINUSE from blockPort exhausting its retries. Widen to 10 attempts at 100ms (~1s total) to give real contention more room to clear before giving up for real. --- src/bridges/user/web/test/port-discovery.unit.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bridges/user/web/test/port-discovery.unit.test.ts b/src/bridges/user/web/test/port-discovery.unit.test.ts index f6f208b..cb23630 100644 --- a/src/bridges/user/web/test/port-discovery.unit.test.ts +++ b/src/bridges/user/web/test/port-discovery.unit.test.ts @@ -7,9 +7,9 @@ import * as http from "node:http"; import { findFreePort } from "../port-discovery.js"; /** How many times to retry a single bind attempt against a transient EADDRINUSE before giving up for real. */ -const BLOCK_PORT_MAX_ATTEMPTS = 5; -/** Delay between retries, long enough for a port an unrelated process grabbed as its own ephemeral source port to be released again. */ -const BLOCK_PORT_RETRY_DELAY_MS = 50; +const BLOCK_PORT_MAX_ATTEMPTS = 10; +/** Delay between retries, long enough for a port an unrelated process grabbed as its own ephemeral source port to be released again. Raised from 50ms/5 attempts (a ~250ms total window) after that budget still wasn't always enough on a loaded CI runner -- 10 attempts at 100ms gives a ~1s window before genuinely giving up. */ +const BLOCK_PORT_RETRY_DELAY_MS = 100; function isErrnoException(error: unknown): error is NodeJS.ErrnoException { return error instanceof Error && "code" in error;