pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/nodejs/node/pull/61804

6552848.css" /> test: fix flaky test-http2-close-while-writing by Han5991 · Pull Request #61804 · nodejs/node · GitHub
Skip to content

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

@Han5991
Copy link
Contributor

@Han5991 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 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
client_stream.on('error', common.mustNotCall());
client_stream.on('close', common.mustCall(() => {
client.close();
client.destroy();
Copy link
Member

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.

Copy link
Contributor Author

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

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

image

Copy link
Member

@lpinca lpinca Feb 14, 2026

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.

@codecov
Copy link

codecov bot commented Feb 13, 2026

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 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 Han5991 force-pushed the test/fix-flaky-http2-close-while-writing branch from bcab32d to 4bc4b5d Compare February 13, 2026 22:34
@Han5991 Han5991 requested a review from lpinca February 13, 2026 22:38
@Han5991 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

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.

3 participants

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy