Skip to content
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

x/net/http2: log encoded hpack field header when GODEBUG=http2debug is set #46339

Closed
KeiichiHirobe opened this issue May 24, 2021 · 6 comments
Closed
Labels
FeatureRequest FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@KeiichiHirobe
Copy link
Contributor

KeiichiHirobe commented May 24, 2021

In HTTP/2, header received is logged like this:

http2: Framer 0xc000890000: read HEADERS flags=END_STREAM|END_HEADERS stream=1 len=63
http2: decoded hpack field header field ":status" = "200"
http2: decoded hpack field header field "server" = "awselb/2.0"
http2: decoded hpack ...
...

But, header sended is logged like this:

http2: Framer 0xc000890000: wrote HEADERS flags=END_HEADERS stream=1 len=775

I'd like to suggest to log hpack field header field not only when decode but also when encode because it is very helpful for debug.

As far as I read code,

Decode log here:
https://github.com/golang/net/blob/fe42d452be8f3a2de6a60623c315a49bd37f0a9a/http2/frame.go#L1497-L1499

To add logging when encode too, maybe we should add logging around here:
https://github.com/golang/net/blob/fe42d452be8f3a2de6a60623c315a49bd37f0a9a/http2/hpack/encode.go#L81

But, we don't have a reference to framer there.
I don't have a good solution for that.

@mknyszek mknyszek added this to the Unreleased milestone May 24, 2021
@mknyszek mknyszek added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label May 24, 2021
@mknyszek
Copy link
Contributor

CC @tombergan @bradfitz via https://dev.golang.org/owners

Also CC @neild, maybe?

@mknyszek mknyszek changed the title x/net/http2: Enable GODEBUG=http2debug to log encoded hpack field header x/net/http2: enable GODEBUG=http2debug to log encoded hpack field header May 24, 2021
@mknyszek
Copy link
Contributor

mknyszek commented May 24, 2021

This is kind of like a feature request? Correct me if I'm wrong @KeiichiHirobe, but you're asking for different behavior of a GODEBUG variable, right?

@mknyszek mknyszek changed the title x/net/http2: enable GODEBUG=http2debug to log encoded hpack field header x/net/http2: log encoded hpack field header when GODEBUG=http2debug is set May 24, 2021
@KeiichiHirobe
Copy link
Contributor Author

KeiichiHirobe commented May 24, 2021

@mknyszek

This is kind of like a feature request?

Yes!

you're asking for different behavior of a GODEBUG variable, right

Yes!

@networkimprov
Copy link

@fraenkel is the go-to guy for HTTP2 matters.

@fraenkel
Copy link
Contributor

I am a bit confused, we already log the outbound headers.

    http2_test.go:66: 2021/05/27 19:05:39 http2: Transport encoding header ":authority" = "127.0.0.1:45689"
    http2_test.go:66: 2021/05/27 19:05:39 http2: Transport encoding header ":method" = "GET"
    http2_test.go:66: 2021/05/27 19:05:39 http2: Transport encoding header ":path" = "/"
    http2_test.go:66: 2021/05/27 19:05:39 http2: Transport encoding header ":scheme" = "https"
    http2_test.go:66: 2021/05/27 19:05:39 http2: Transport encoding header "accept-encoding" = "gzip"
    http2_test.go:66: 2021/05/27 19:05:39 http2: Transport encoding header "user-agent" = "Go-http-client/2.0"

@KeiichiHirobe
Copy link
Contributor Author

@fraenkel

Sorry for the late reply, and I was mistaken.
I am a user of https://github.com/grpc/grpc-go, and maybe this is a problem of grpc-go.

grpc-go logs decoded hpack field through net/http2/frame.go, but never logs encoded hpack field at https://github.com/grpc/grpc-go/blob/4faa31f0a5809a5064ee128c9d855c0bedc1c783/internal/transport/controlbuf.go#L682.

Anyway, this is not a issue for golang/go, So I close this issue.

@golang golang locked and limited conversation to collaborators Jun 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FeatureRequest FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

5 participants