test: fix flaky test-bench-stream - #65874
Open
mcollina wants to merge 3 commits into
Open
Conversation
mcollina
force-pushed
the
fix-bench-stream-timeout-flake
branch
from
September 7, 2026 08:53
de7d9e4 to
6ace0d8
Compare
testDeliveryDoesNotConsumeTimeout gave the benchmark a 20ms timeout while stalling the consumer for 50ms. Only delivery time is credited back to the deadline, so the 32 samples still had to run within 20ms, which is about a 10x margin on an idle machine and not enough on a loaded CI runner. Scale the timeout and the stall together so the benchmark's own work gets 500ms of headroom while the consumer still stalls for longer than the timeout. Signed-off-by: Matteo Collina <hello@matteocollina.com>
mcollina
force-pushed
the
fix-bench-stream-timeout-flake
branch
from
September 7, 2026 09:13
6ace0d8 to
a603d7f
Compare
Contributor
|
Fast-track has been requested by @mcollina. Please 👍 to approve. |
panva
approved these changes
Sep 7, 2026
This comment was marked as outdated.
This comment was marked as outdated.
ShogunPanda
approved these changes
Sep 7, 2026
aduh95
reviewed
Sep 7, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #65874 +/- ##
==========================================
- Coverage 92.40% 90.19% -2.21%
==========================================
Files 417 771 +354
Lines 188648 264911 +76263
Branches 28849 50316 +21467
==========================================
+ Hits 174320 238938 +64618
- Misses 13995 16926 +2931
- Partials 333 9047 +8714 🚀 New features to boost your workflow:
|
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
panva
approved these changes
Sep 7, 2026
aduh95
reviewed
Sep 7, 2026
panva
approved these changes
Sep 7, 2026
jasnell
approved these changes
Sep 7, 2026
Collaborator
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.
testDeliveryDoesNotConsumeTimeoutgave the benchmark a 20ms timeout while stalling the stream consumer for 50ms. The harness only credits delivery time back to the deadline (pause()inlib/internal/bench_runner/harness.js), so the 32 samples the benchmark runs still have to fit inside the 20ms budget. That work costs 1-2ms on an idle machine, so the margin is only ~10x and a loaded CI runner blows through it.Seen on macOS in https://github.com/nodejs/node/actions/runs/34090282687/job/101642182203 (unrelated PR):
This scales the timeout and the stall together: the benchmark's own work now has 500ms of headroom, while the consumer still stalls for twice the timeout, so the test keeps failing if delivery time is ever charged against the benchmark.
Measured locally with 64 competing spinners, 100 runs each:
Verified the test still catches the regression it was written for by making
pause()stop extending the deadline — it fails withBenchmark timed out after 500ms.