Skip to content

test: add retry logic for eventloopdelay histogram sampling#61796

Open
mcollina wants to merge 1 commit intonodejs:mainfrom
mcollina:fix-flaky-test-performance-eventloopdelay-v2
Open

test: add retry logic for eventloopdelay histogram sampling#61796
mcollina wants to merge 1 commit intonodejs:mainfrom
mcollina:fix-flaky-test-performance-eventloopdelay-v2

Conversation

@mcollina
Copy link
Member

Summary

Fixes flaky test-performance-eventloopdelay test on sharedlibs builds.

Problem

On some build configurations (e.g., Ubuntu 24.04 sharedlibs), the histogram may not record valid samples (min > 0) after the initial spinning period. The test fails with:

AssertionError [ERR_ASSERTION]: assert(histogram.min > 0)

The previous fix (PR #61629) added setImmediate to allow samples to be recorded, but this wasn't sufficient for all configurations.

Solution

Add a retry mechanism that checks if valid samples have been recorded (count > 0 && min > 0 && max > 0). If not, the test will spin the event loop additional times (up to 3 retries) before asserting.

This ensures the test passes on slower or differently-configured systems where event loop delay sampling may take longer to produce measurable results.

Verification

Tested locally with python3 tools/test.py --repeat 30 - all passed.

Refs: nodejs/reliability#1461

@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 Feb 12, 2026
@codecov
Copy link

codecov bot commented Feb 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.74%. Comparing base (4a13a62) to head (ad1c0a7).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #61796      +/-   ##
==========================================
- Coverage   89.76%   89.74%   -0.02%     
==========================================
  Files         675      675              
  Lines      204674   204674              
  Branches    39330    39325       -5     
==========================================
- Hits       183716   183689      -27     
- Misses      13235    13252      +17     
- Partials     7723     7733      +10     

see 29 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.

@mcollina mcollina force-pushed the fix-flaky-test-performance-eventloopdelay-v2 branch from 46dd75d to a0b9aa0 Compare February 13, 2026 07:42
On some build configurations (e.g., sharedlibs), the histogram may not
record valid samples (min > 0) after the initial spinning period. This
adds a retry mechanism that will spin the event loop additional times
if valid samples haven't been recorded yet.

This helps ensure the test passes on slower or differently-configured
systems where event loop delay sampling may take longer to produce
measurable results.

Refs: nodejs/reliability#1461
@mcollina mcollina force-pushed the fix-flaky-test-performance-eventloopdelay-v2 branch from a0b9aa0 to ad1c0a7 Compare February 13, 2026 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. test Issues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants