Skip to content

fix: clean up benchmark resources before worker exit#5225

Merged
mcollina merged 1 commit into
nodejs:mainfrom
trivikr:test-benchmark
May 6, 2026
Merged

fix: clean up benchmark resources before worker exit#5225
mcollina merged 1 commit into
nodejs:mainfrom
trivikr:test-benchmark

Conversation

@trivikr
Copy link
Copy Markdown
Member

@trivikr trivikr commented May 6, 2026

This relates to...

Fixes: #5213

Rationale

cronometro runs each benchmark case in a worker. Since benchmark.js creates HTTP agents and Undici dispatchers at module scope, each worker can exit with live keep-alive resources. Explicitly cleaning those resources up before worker exit should avoid intermittent native teardown crashes during benchmark runs.

Changes

  • Destroy benchmark HTTP agents and Undici dispatchers during cleanup.
  • Attach cleanup as a cronometro after hook for each benchmark worker.
  • Keep final cleanup after benchmark results are printed.

Features

N/A

Bug Fixes

N/A

Breaking Changes and Deprecations

N/A

Status

Assisted-by: openai:gpt-5.5

Assisted-by: openai:gpt-5.5
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.27%. Comparing base (da0eebc) to head (3e029f4).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5225   +/-   ##
=======================================
  Coverage   93.27%   93.27%           
=======================================
  Files         110      110           
  Lines       36353    36353           
=======================================
+ Hits        33907    33909    +2     
+ Misses       2446     2444    -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 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.

Copy link
Copy Markdown
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@mcollina mcollina merged commit 6975334 into nodejs:main May 6, 2026
60 of 61 checks passed
@trivikr trivikr deleted the test-benchmark branch May 6, 2026 21:46
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.

[flaky] benchmark.js

3 participants