Skip to content

http2: add diagnostics channel 'http2.server.stream.start' #58449

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

RaisinTen
Copy link
Member

No description provided.

Signed-off-by: Darshan Sen <raisinten@gmail.com>
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/http2
  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added http2 Issues or PRs related to the http2 subsystem. needs-ci PRs that need a full CI run. labels May 25, 2025
@RaisinTen RaisinTen added the diagnostics_channel Issues and PRs related to diagnostics channel label May 25, 2025
@nodejs-github-bot

This comment was marked as outdated.

Copy link

codecov bot commented May 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.22%. Comparing base (c3b580d) to head (434dbaf).
Report is 46 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #58449      +/-   ##
==========================================
+ Coverage   90.19%   90.22%   +0.03%     
==========================================
  Files         635      635              
  Lines      187255   187588     +333     
  Branches    36775    36836      +61     
==========================================
+ Hits       168896   169256     +360     
+ Misses      11137    11096      -41     
- Partials     7222     7236      +14     
Files with missing lines Coverage Δ
lib/internal/http2/core.js 95.55% <100.00%> (+0.04%) ⬆️

... and 59 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.

@lpinca lpinca added the request-ci Add this label to start a Jenkins CI on a PR. label May 25, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label May 25, 2025
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@RaisinTen RaisinTen added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label May 26, 2025
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@@ -1246,6 +1246,13 @@ closing the stream can be retrieved using the `stream.rstCode` property.

Emitted when a stream is created on the server.

`http2.server.stream.start`
Copy link
Member

@Flarna Flarna May 27, 2025

Choose a reason for hiding this comment

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

It seems this one comes always together with http2.server.stream.created. In one case there is a nextTick in between.

Which use case is solved by this extra event?

If the timing between created and start is important we should test the timing stays as expected.

Copy link
Member Author

Choose a reason for hiding this comment

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

The distinction between the two is that 'created' is for when the stream has just been created but 'start' is where the application starts using the stream. Here, 'start' gets called in the nextTick because that's where the pushStream callback gets invoked, where the user code can start using the push stream. I have added a test for the timings, PTAL @Flarna .

Copy link
Member

Choose a reason for hiding this comment

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

But they always come in pairs, sometimes with a nextTick inbetween, sometimes not.
But there is no case where a create is not immediately followed by a start right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that's right. It could be useful to debug any performance issues that might be stemming from the blocking code that runs after pushStream() get called but before the callback is fired.

Signed-off-by: Darshan Sen <raisinten@gmail.com>
@nodejs-github-bot

This comment was marked as outdated.

// Since ServerHttp2Stream is not exported from any module, this just checks
// if the stream is an instance of Duplex and the constructor name is
// 'ServerHttp2Stream'.
assert.ok(stream instanceof Duplex);
Copy link
Member

Choose a reason for hiding this comment

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

note that exposing internals makes it hard to ever move this out of experimental at some point in time in future.

Copy link
Member Author

@RaisinTen RaisinTen May 28, 2025

Choose a reason for hiding this comment

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

ServerHttp2Stream is actually a part of the public API. It's just that this class is not exposed for direct use by application code, like new ServerHttp2Stream(), although users still can by accessing the .constructor property of one of these instances.

@nodejs-github-bot

This comment was marked as outdated.

@RaisinTen RaisinTen added the commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. label May 28, 2025
@nodejs-github-bot
Copy link
Collaborator

@RaisinTen RaisinTen added the commit-queue Add this label to land a pull request using GitHub Actions. label May 29, 2025
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label May 29, 2025
@nodejs-github-bot nodejs-github-bot merged commit fd46569 into nodejs:main May 29, 2025
60 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in fd46569

@RaisinTen RaisinTen deleted the http2-add-diagnostics-channel-http2.server.stream.start branch May 29, 2025 11:17
targos pushed a commit that referenced this pull request May 31, 2025
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: #58449
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
aduh95 pushed a commit that referenced this pull request Jun 10, 2025
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: #58449
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. diagnostics_channel Issues and PRs related to diagnostics channel http2 Issues or PRs related to the http2 subsystem. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants