diff --git a/test/flaky-tests.txt b/test/flaky-tests.txt index 310cfde543ed..985810b30bf1 100644 --- a/test/flaky-tests.txt +++ b/test/flaky-tests.txt @@ -108,7 +108,7 @@ test/js/web/fetch/fetch.stream.test.ts # 11 of 80 builds; should drain response test/js/web/fetch/fetch.tls.wildcard.test.ts # the peer closed the connection before the TLS handshake finished (3 builds, macOS), not root-caused test/js/web/workers/structuredClone-classes.test.ts # 20 of 80 builds; parallel batch; (worker crashed): worker process crashed before reporting results (in the parallel bat... test/js/web/workers/worker-late-completion.test.ts # work that comes back after its worker began tearing down > BroadcastChannel message from another thread: seen was false (build 109486, debian 13 x64-asan) -test/js/web/workers/worker-terminate-lifetime.test.ts # 11 of 80 builds; worker exit with streaming-request-body fetches whose response.body was touched: expec... +test/js/web/workers/worker-terminate-lifetime.test.ts # a worker ends while a stream is still being piped into a FileSink: Segmentation fault on a libuv-worker thread (4 builds, Windows, e.g. 126359), not root-caused test/js/workerd/html-rewriter.test.js # 1 of 80 builds; mac test/napi/napi-value-ffi.test.ts # 1 of 80 builds; mac; error: build failed test/napi/napi.test.ts # 22 of 80 builds diff --git a/test/js/web/workers/worker-terminate-lifetime.test.ts b/test/js/web/workers/worker-terminate-lifetime.test.ts index c7fe4ecd37a9..92c79f6db66d 100644 --- a/test/js/web/workers/worker-terminate-lifetime.test.ts +++ b/test/js/web/workers/worker-terminate-lifetime.test.ts @@ -1024,19 +1024,22 @@ test( for (let i = 0; i < N; i++) { const w = new Worker(\` const keep = []; + const fetches = 8; let touched = 0; - for (let j = 0; j < 8; j++) { + for (let j = 0; j < fetches; j++) { let ctrl; const body = new ReadableStream({ start(c) { ctrl = c; c.enqueue(new Uint8Array(1024)); } }); const p = fetch("\${server.url}", { method: "POST", body, duplex: "half" }) - .then((r) => { keep.push(r.body); const rd = r.body.getReader(); rd.read(); keep.push(rd); touched++; }) - .catch(() => {}); + .then((r) => { + keep.push(r.body); const rd = r.body.getReader(); rd.read(); keep.push(rd); + // Every fetch has that state. The streams then run on, for a different time in each + // worker, so the exits land at arbitrary points of a transfer: no event marks those. + if (++touched === fetches) setTimeout(() => process.exit(0), 150 + \${(i * 13) % 60}); + }) + .catch((e) => { console.error(e); process.exit(3); }); keep.push(p, ctrl); setInterval(() => { try { ctrl.enqueue(new Uint8Array(512)); } catch {} }, 5); } - // Exit with that state alive; exit code 3 if no fetch ever reached it (the test would - // then not be exercising what it claims to). - setTimeout(() => process.exit(touched > 0 ? 0 : 3), 150 + \${(i * 13) % 60}); \`, { eval: true }); w.on("error", (e) => { console.error(e); process.exit(1); }); w.on("exit", (code) => {