Skip to content

Give timeoutDisarmedByCompletion room on a loaded machine - #8993

Merged
danlapid merged 1 commit into
mainfrom
dlapid/http-client-timeout-disarm-flake
Nov 29, 2026
Merged

danlapid merged 1 commit into
mainfrom
dlapid/http-client-timeout-disarm-flake

Conversation

@danlapid

Copy link
Copy Markdown
Collaborator

Fixes a flake in //src/tests/node/http-client:http-client-ts@, case timeoutDisarmedByCompletion, seen on the macOS job in https://github.com/cloudflare/workerd/actions/runs/46317198669/job/141516706748:

workerd/io/io-context/ffi.c++:441: info: uncaught exception; source = Uncaught (in promise); stack = Error: aborted
    at ClientRequest.destroy (node-internal:internal_http_client:448:30)
[ FAIL ] node-http-client-ts:timeoutDisarmedByCompletion (87.014916ms)

The test armed a 40 ms idle timeout once the response headers arrived, and it failed if the timeout fired before the body completed. On a loaded runner, reading the rest of the 3-byte response took longer than 40 ms, so the timer fired and destroyed the request.

This uses the 250 ms timeout that timeoutIsIdleNotDeadline already uses, and waits 300 ms after completion. The wait is longer than the timeout, so a timer that completion failed to disarm would still fire during the test. The test now takes about 300 ms.

Tested: bazel test --runs_per_test=10 on http-client-ts@, @all-compat-flags and @all-autogates: 10/10 each, on Linux.

🤖 Generated with Claude Code

The test armed a 40 ms idle timeout once the response headers arrived
and failed if it fired before the body completed. On a busy macOS CI
runner, reading the rest of the 3-byte response took longer than
that: the timer fired, destroyed the request, and the test failed
with an uncaught "aborted" in 87 ms.

Use the 250 ms timeout that timeoutIsIdleNotDeadline already uses,
and wait 300 ms after completion, longer than the timeout, so a timer
the completion failed to disarm would still fire within the test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@danlapid
danlapid marked this pull request as ready for review November 29, 2026 22:49
@danlapid
danlapid requested review from a team as code owners November 29, 2026 22:49

@clanky-the-clanker clanky-the-clanker Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Approved — Test-only change that widens timing margins to fix a flake. No findings.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

📋 Code reviewer: ✅ LGTM

No issues found.


Reviewed commit: bdcc7fe3

@danlapid
danlapid merged commit 6508436 into main Nov 29, 2026
24 checks passed
@danlapid
danlapid deleted the dlapid/http-client-timeout-disarm-flake branch November 29, 2026 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant