GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Use real, instead of synthetic, HTTP/2 stream id by chrisvest · Pull Request #15842 · netty/netty

Conversation

@chrisvest

@chrisvest chrisvest commented Nov 11, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Motivation:
The AbstractHttp2StreamChannel subclasses use a synthetic id in their ChannelId, but include the real stream id in their toString() method.
Using two different ids makes it harder to correlate the two in logs.
The synthetic ids are necessary because the stream id is assigned at a protocol level at some point after the channel has been created.

Modification:
Include the synthetic id in the AbstractHttp2StreamChannel.toString() output.

Result:
Easier to correlate HTTP/2 channel and stream ids, to help with debugging.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@chrisvest
Use real, instead of synthetic, HTTP/2 stream id
1ebed73
Motivation:
The synthetic stream ids cause confusion because they create a discrepancy between the ids observed through the `Channel.id()` method, and the `AbstractHttp2StreamChannel.toString()` method.

Modification:
Remove the generation of synthetic ids and instead use the id from the `Http2Stream` object.

Result:
Consistent stream ids.
@chrisvest chrisvest added this to the 4.1.129.Final milestone Nov 11, 2025
@chrisvest
chrisvest requested review from idelpivnitskiy and normanmaurer November 11, 2025 23:05
normanmaurer
normanmaurer requested changes Nov 13, 2025
View reviewed changes
Comment thread codec-http2/src/main/java/io/netty/handler/codec/http2/AbstractHttp2StreamChannel.java Outdated

closePromise = pipeline.newPromise();
channelId = new Http2StreamChannelId(parent().id(), id);
channelId = new Http2StreamChannelId(parent().id(), stream.id());

@normanmaurer normanmaurer Nov 13, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This was actually done by design as stream.id() will return -1 until a header frame was send or received and only after that change.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@idelpivnitskiy idelpivnitskiy Nov 17, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Can we then pass stream down to Http2StreamChannelId and it will return -1 until a real id is assigned?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@chrisvest chrisvest Nov 17, 2025

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

ChannelId instances are meant to be immutable because they're used as keys on maps.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@chrisvest chrisvest added the needs-cherry-pick-4.2 This PR should be cherry-picked to 4.2 once merged. label Nov 13, 2025
@chrisvest
Revert "Use real, instead of synthetic, HTTP/2 stream id"
eb2a106
This reverts commit 1ebed73.
@chrisvest

chrisvest commented Nov 13, 2025

Copy link
Copy Markdown
Member Author

In that case we can amend the toString to include both ids.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chrisvest
Include the stream sequence id in the H2 stream channel toString
3255102
@normanmaurer

normanmaurer commented Nov 14, 2025

Copy link
Copy Markdown
Member

@chrisvest LGTM... Please squash and adjust commit message and pull in .

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

idelpivnitskiy
idelpivnitskiy requested changes Nov 17, 2025
View reviewed changes
Comment thread codec-http2/src/main/java/io/netty/handler/codec/http2/AbstractHttp2StreamChannel.java
@Override
public String toString() {
return parent().toString() + "(H2 - " + stream + ')';
return parent().toString() + '/' + channelId.getSequenceId() + " (H2 - " + stream + ')';

@idelpivnitskiy idelpivnitskiy Nov 17, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

That will be more confusing and break existing parsers for channel.toString() that extract id and local/remote addresses

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@chrisvest chrisvest Nov 17, 2025

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

What are these parsers? Are you thinking splunk queries, or is there some data in here you'd rather have a getter method for?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@normanmaurer normanmaurer Nov 17, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Also honestly nobody should depend on toString() formatting to be stable...

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@idelpivnitskiy idelpivnitskiy Nov 18, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Actually, I misread it. I assumed that new format will be [id: 0xaa5dbac4/1, L:/127.0.0.1:52093 - R:/127.0.0.1:52094](H2 - 3) but it actually will be [id: 0xaa5dbac4, L:/127.0.0.1:52093 - R:/127.0.0.1:52094]/1(H2 - 3). In this case, it should not break anyone.

I agree that ideally ppl should not depend on it, but in reality they do. And the separators are not a problem, the problem could be if id changes from 0xaa5dbac4 to 0xaa5dbac4/1

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chrisvest reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
idelpivnitskiy
idelpivnitskiy approved these changes Nov 18, 2025
View reviewed changes

@idelpivnitskiy idelpivnitskiy left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

We should be good based on the above comment: https://github.com/netty/netty/pull/15842/files#r2538137668

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chrisvest reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@chrisvest chrisvest added the needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. label Nov 18, 2025
@chrisvest
chrisvest merged commit d01673a into netty:4.1 Nov 18, 2025
@chrisvest
chrisvest deleted the 4.1-h2-streamid branch November 18, 2025 19:00
chrisvest added a commit to chrisvest/netty that referenced this pull request Nov 18, 2025
@chrisvest
Use real, instead of synthetic, HTTP/2 stream id (netty#15842)
cb92435
Motivation:
The `AbstractHttp2StreamChannel` subclasses use a synthetic id in their
`ChannelId`, but include the real stream id in their `toString()`
method.
Using two different ids makes it harder to correlate the two in logs.
The synthetic ids are necessary because the stream id is assigned at a
protocol level at some point after the channel has been created.

Modification:
Include the synthetic id in the `AbstractHttp2StreamChannel.toString()`
output.

Result:
Easier to correlate HTTP/2 channel and stream ids, to help with
debugging.

(cherry picked from commit d01673a)
chrisvest added a commit to chrisvest/netty that referenced this pull request Nov 18, 2025
@chrisvest
Use real, instead of synthetic, HTTP/2 stream id (netty#15842)
85f4a0c
Motivation:
The `AbstractHttp2StreamChannel` subclasses use a synthetic id in their
`ChannelId`, but include the real stream id in their `toString()`
method.
Using two different ids makes it harder to correlate the two in logs.
The synthetic ids are necessary because the stream id is assigned at a
protocol level at some point after the channel has been created.

Modification:
Include the synthetic id in the `AbstractHttp2StreamChannel.toString()`
output.

Result:
Easier to correlate HTTP/2 channel and stream ids, to help with
debugging.
normanmaurer pushed a commit that referenced this pull request Nov 19, 2025
@chrisvest
Use real, instead of synthetic, HTTP/2 stream id (#15842) (#15887)
ed26fd4
Motivation:
The `AbstractHttp2StreamChannel` subclasses use a synthetic id in their
`ChannelId`, but include the real stream id in their `toString()`
method.
Using two different ids makes it harder to correlate the two in logs.
The synthetic ids are necessary because the stream id is assigned at a
protocol level at some point after the channel has been created.

Modification:
Include the synthetic id in the `AbstractHttp2StreamChannel.toString()`
output.

Result:
Easier to correlate HTTP/2 channel and stream ids, to help with
debugging.
normanmaurer pushed a commit that referenced this pull request Nov 19, 2025
@chrisvest
Use real, instead of synthetic, HTTP/2 stream id (#15842) (#15886)
18f8a5c
Motivation:
The `AbstractHttp2StreamChannel` subclasses use a synthetic id in their
`ChannelId`, but include the real stream id in their `toString()`
method.
Using two different ids makes it harder to correlate the two in logs.
The synthetic ids are necessary because the stream id is assigned at a
protocol level at some point after the channel has been created.

Modification:
Include the synthetic id in the `AbstractHttp2StreamChannel.toString()`
output.

Result:
Easier to correlate HTTP/2 channel and stream ids, to help with
debugging.

(cherry picked from commit d01673a)
@chrisvest chrisvest removed needs-cherry-pick-4.2 This PR should be cherry-picked to 4.2 once merged. needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. labels Jun 29, 2026
This was referenced Sep 14, 2026
Http2: Reserve promised stream for PUSH_PROMISE after local RST_STREAM #17471
Closed
cache failure 1233e4a5 #17565
Closed
@normanmaurer normanmaurer mentioned this pull request Sep 22, 2026
suspend race fix #17588
Closed
@normanmaurer normanmaurer mentioned this pull request Oct 1, 2026
child5 #17695
Closed
This was referenced Oct 20, 2026
fix iouring zerocopy iov overwrite #17936
Closed
crisp nova cceda091 #18109
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@normanmaurer normanmaurer normanmaurer requested changes
@idelpivnitskiy idelpivnitskiy idelpivnitskiy approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

4.1.129.Final

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@chrisvest @normanmaurer @idelpivnitskiy
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.