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: hpack.(*Encoder).WriteField panic errors #47882

Closed
v-byte-cpu opened this issue Aug 22, 2021 · 4 comments
Closed

x/net/http2: hpack.(*Encoder).WriteField panic errors #47882

v-byte-cpu opened this issue Aug 22, 2021 · 4 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@v-byte-cpu
Copy link

What version of Go are you using (go version)?

$ go version
go version go1.16.7 linux/amd64

Does this issue reproduce with the latest release?

Not tested

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/user/.cache/go-build"
GOENV="/home/user/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/user/workspace/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/user/workspace/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.16.7"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/user/workspace/example/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3609040575=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Making concurrent HTTP/2 requests to server using DefaultClient net/http.(*Client).Do method,
I periodically get the following panic error messages.

panic(0x7fd500, 0xc0000ff730)
        /usr/lib/go/src/runtime/panic.go:965 +0x1b9
vendor/golang.org/x/net/http2/hpack.(*headerFieldTable).idToIndex(0xc0003ee080, 0x20, 0xc00029c6b8)
        /usr/lib/go/src/vendor/golang.org/x/net/http2/hpack/tables.go:119 +0x12c
vendor/golang.org/x/net/http2/hpack.(*headerFieldTable).search(0xc0003ee080, 0xc000405f60, 0xe, 0xc000410280, 0x5, 0x0, 0x0, 0x0)
        /usr/lib/go/src/vendor/golang.org/x/net/http2/hpack/tables.go:106 +0x150
vendor/golang.org/x/net/http2/hpack.(*Encoder).searchTable(0xc0003ee080, 0xc000405f60, 0xe, 0xc000410280, 0x5, 0x0, 0x0, 0x0)
        /usr/lib/go/src/vendor/golang.org/x/net/http2/hpack/encode.go:97 +0x92
vendor/golang.org/x/net/http2/hpack.(*Encoder).WriteField(0xc0003ee080, 0xc000405f60, 0xe, 0xc000410280, 0x5, 0x0, 0x0, 0x0)
        /usr/lib/go/src/vendor/golang.org/x/net/http2/hpack/encode.go:62 +0x20a
net/http.(*http2ClientConn).writeHeader(0xc000294d80, 0xc000405f60, 0xe, 0xc000410280, 0x5)
        /usr/lib/go/src/net/http/h2_bundle.go:8183 +0xbc
net/http.(*http2ClientConn).encodeHeaders.func3(0xc000405780, 0xe, 0xc000410280, 0x5)
        /usr/lib/go/src/net/http/h2_bundle.go:8122 +0x93
net/http.(*http2ClientConn).encodeHeaders.func1(0xc00029cb50)
        /usr/lib/go/src/net/http/h2_bundle.go:8088 +0x3d5
net/http.(*http2ClientConn).encodeHeaders(0xc000294d80, 0xc000c28800, 0x1, 0x0, 0x0, 0xffffffffffffffff, 0x881553, 0x10000000000000e, 0x7effe9ae8550, 0x0, ...)
        /usr/lib/go/src/net/http/h2_bundle.go:8120 +0x5e8
net/http.(*http2ClientConn).roundTrip(0xc000294d80, 0xc000c28800, 0x0, 0x0, 0x0, 0x0)
        /usr/lib/go/src/net/http/h2_bundle.go:7583 +0x2bb
net/http.(*http2Transport).RoundTripOpt(0xc0002ae700, 0xc000c28800, 0x810e00, 0xc000288480, 0x87e638, 0x5)
        /usr/lib/go/src/net/http/h2_bundle.go:6981 +0x1a5
net/http.(*http2Transport).RoundTrip(...)
        /usr/lib/go/src/net/http/h2_bundle.go:6942
net/http.http2noDialH2RoundTripper.RoundTrip(0xc0002ae700, 0xc000c28800, 0x9020a0, 0xc0002ae700, 0x0)
        /usr/lib/go/src/net/http/h2_bundle.go:9197 +0x3e
net/http.(*Transport).roundTrip(0xb87a00, 0xc000c28700, 0x7f0013b98f18, 0x580, 0xc000c5f700)
        /usr/lib/go/src/net/http/transport.go:537 +0xdec
net/http.(*Transport).RoundTrip(0xb87a00, 0xc000c28700, 0xb87a00, 0x0, 0x0)
        /usr/lib/go/src/net/http/roundtrip.go:17 +0x35
net/http.send(0xc000c28700, 0x901640, 0xb87a00, 0x0, 0x0, 0x0, 0xc000aceb18, 0xc000a44a80, 0x1, 0x0)
        /usr/lib/go/src/net/http/client.go:251 +0x454
net/http.(*Client).send(0xc0001b8660, 0xc000c28700, 0x0, 0x0, 0x0, 0xc000aceb18, 0x0, 0x1, 0x2a)
        /usr/lib/go/src/net/http/client.go:175 +0xff
net/http.(*Client).do(0xc0001b8660, 0xc000c28700, 0x0, 0x0, 0x0)
        /usr/lib/go/src/net/http/client.go:717 +0x45f
net/http.(*Client).Do(0xc0001b8660, 0xc000c28700, 0xc000c28700, 0x0, 0x0)
        /usr/lib/go/src/net/http/client.go:585 +0x35

What did you expect to see?

No panic errors

What did you see instead?

Panic errors

v-byte-cpu added a commit to v-byte-cpu/juicyrout that referenced this issue Aug 22, 2021
temporarily change http transport to HTTP 1.1
until the bug golang/go#47882 is fixed
v-byte-cpu added a commit to v-byte-cpu/juicyrout that referenced this issue Aug 22, 2021
temporarily change http transport to HTTP 1.1
until the bug golang/go#47882 is fixed
@seankhliao
Copy link
Member

have you tried running it under the race detector?

@seankhliao seankhliao added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Aug 23, 2021
@v-byte-cpu
Copy link
Author

yes, sure, I built an app using go build -race and started again, a panic error occurred, but a data race report was not generated.

@AlexanderYastrebov
Copy link
Contributor

Apparently duplicate of #43051

@neild
Copy link
Contributor

neild commented Oct 15, 2021

Duplicate of #43051.

(Added a comment there--tl;dr, if you ever write requests with trailers, this may have been fixed already in x/net.)

@neild neild closed this as completed Oct 15, 2021
@golang golang locked and limited conversation to collaborators Oct 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

5 participants