test: avoid timer race in event loop delay test#64728
Draft
trivikr wants to merge 1 commit into
Draft
Conversation
An expired timer can run before the first complete event loop iteration, disabling the histogram before it records any samples. Drive a known number of iterations with setImmediate before checking the histograms, and share the chain between resolution variants. Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com> Assisted-by: codex:gpt-5.6-sol
Member
Author
|
Stress tests on |
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.
Refs: https://github.com/nodejs/reliability/issues?q=sort%3Aupdated-desc%20test-performance-eventloopdelay
Problem
The test enables the histogram and checks it from a 20 ms timer.
On slow or contended systems, that timer can expire before the first complete event loop iteration.
The timer then disables the histogram before its
uv_checkcallback records a sample.Previous fixes addressed related but distinct failures:
The failing
samplePerIterationchecks were added later by #62935 and still depend on elapsed time.Solution
Drive a known number of event loop iterations using
setImmediatebefore disabling and checking each histogram.The default-resolution and large-resolution checks share one iteration chain, removing the duplicated timing logic.
Assisted-by: codex:gpt-5.6-sol