Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

test: fix flaky test-http2-close-while-writing#61804

Draft
Han5991 wants to merge 1 commit intonodejs:mainfrom
Han5991:test/fix-flaky-http2-close-while-writing
Draft

test: fix flaky test-http2-close-while-writing#61804
Han5991 wants to merge 1 commit intonodejs:mainfrom
Han5991:test/fix-flaky-http2-close-while-writing

Conversation

Copy link
Contributor

Han5991 commented Feb 13, 2026

The test was flaky due to a race condition where client.close() would
wait for a graceful shutdown while the server had already destroyed the
session/stream, leading to a timeout.

Changes:

  • Replace client.close() with client.destroy() in the close event
    handler of the client stream.
  • Add common.mustNotCall() error handlers to the client, client stream,
    and server session to catch unexpected errors.
  • Add check if (!client_stream.destroyed) before destroying client
    stream in the server's data handler.

Refs: #33156

nodejs-github-bot added needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. labels Feb 13, 2026
lpinca reviewed Feb 13, 2026
client_stream.on('error', common.mustNotCall());
client_stream.on('close', common.mustCall(() => {
client.close();
client.destroy();
Copy link
Member

lpinca Feb 13, 2026

Choose a reason for hiding this comment

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

It is still not clear to me why this callback

const writeCallback = (err) => {
waitingForWriteCallback = false;
writeCallbackErr = err;
done();
};
is not called. See #58252.

Han5991 reacted with eyes emoji
Copy link
Contributor Author

Han5991 Feb 14, 2026

Choose a reason for hiding this comment

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

I agree with your suggestion. Using destroy() feels more natural here given the test scenario involves an abrupt disconnection while writing.

Copy link
Contributor Author

Han5991 Feb 14, 2026

Choose a reason for hiding this comment

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

I tested it with the test method in issue 58252

Copy link
Member

lpinca Feb 14, 2026 *
edited
Loading

Choose a reason for hiding this comment

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

This hides the bug, the callback should be called.

Han5991 reacted with eyes emoji
Copy link

codecov bot commented Feb 13, 2026 *
edited
Loading

Codecov Report

All modified and coverable lines are covered by tests.
Project coverage is 89.75%. Comparing base (3d30c30) to head (4bc4b5d).
Report is 7 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@
## main #61804 +/- ##
==========================================
- Coverage 89.75% 89.75% -0.01%
==========================================
Files 675 675
Lines 204676 204735 +59
Branches 39329 39341 +12
==========================================
+ Hits 183705 183752 +47
+ Misses 13272 13269 -3
- Partials 7699 7714 +15

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

Han5991 force-pushed the test/fix-flaky-http2-close-while-writing branch from df7750e to bcab32d Compare February 13, 2026 22:32
The test was flaky due to a race condition where `client.close()` would
wait for a graceful shutdown while the server had already destroyed the
session/stream, leading to a timeout.

Changes:
- Replace `client.close()` with `client.destroy()` in the `close`
event handler of the client stream.

Refs: nodejs#33156
Han5991 force-pushed the test/fix-flaky-http2-close-while-writing branch from bcab32d to 4bc4b5d Compare February 13, 2026 22:34
Han5991 requested a review from lpinca February 13, 2026 22:38
Han5991 marked this pull request as draft February 14, 2026 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

lpinca Awaiting requested review from lpinca

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

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

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants