Skip to content

test: avoid timer race in event loop delay test - #64728

Open
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:test-performance-eventloopdelay
Open

test: avoid timer race in event loop delay test#64728
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:test-performance-eventloopdelay

Conversation

@trivikr

@trivikr trivikr commented Jul 25, 2026

Copy link
Copy Markdown
Member

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_check callback records a sample.

Previous fixes addressed related but distinct failures:

The failing samplePerIteration checks were added later by #62935 and still depend on elapsed time.

Solution

Drive a known number of event loop iterations using setImmediate before 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

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. labels Jul 25, 2026
@trivikr trivikr added the flaky-test Issues and PRs related to the tests with unstable failures on the CI. label Jul 25, 2026
@trivikr

trivikr commented Jul 25, 2026

Copy link
Copy Markdown
Member Author

@trivikr
trivikr marked this pull request as ready for review July 25, 2026 21:40
@codecov

codecov Bot commented Jul 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.32%. Comparing base (bfa3e98) to head (f862517).
⚠️ Report is 12 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #64728      +/-   ##
==========================================
- Coverage   90.32%   90.32%   -0.01%     
==========================================
  Files         760      760              
  Lines      249130   249130              
  Branches    47041    47041              
==========================================
- Hits       225030   225023       -7     
- Misses      15490    15494       +4     
- Partials     8610     8613       +3     

see 24 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@trivikr trivikr added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 26, 2026
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
@trivikr
trivikr force-pushed the test-performance-eventloopdelay branch from c040df1 to f862517 Compare August 12, 2026 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flaky-test Issues and PRs related to the tests with unstable failures on the CI. needs-ci PRs that need a full CI run. request-ci Add this label to start a Jenkins CI on a PR. test Issues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants