Skip to content

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

@v-byte-cpu

Description

@v-byte-cpu

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.WaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions