Skip to content

x/net/http2: Transport leaks goroutines (awaitRequestCancel) #24776

Closed
@g7r

Description

@g7r

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

go version go1.10 darwin/amd64
go version go1.10.1 linux/amd64

Does this issue reproduce with the latest release?

Yes

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/sz/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/sz/src/gohome"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.10/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.10/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/9h/x_80x8ln3_g038_zj_t9tszw0000gn/T/go-build456657465=/tmp/go-build -gno-record-gcc-switches -fno-common"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/sz/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/sz/go"
GORACE=""
GOROOT="/home/sz/goroot/1.10.1/go"
GOTMPDIR=""
GOTOOLDIR="/home/sz/goroot/1.10.1/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
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-build220690427=/tmp/go-build -gno-record-gcc-switches"

What did you do?

HTTP2 client leaks goroutines when the following conditions are met:

  1. http.Client has Timeout set
  2. TLS connections are forcibly dropped
  3. MaxConcurrentStreams is reasonably low

Test program that reproduces the issue: https://gist.github.com/g7r/3044f20a47e5d41630d9a2cdc5c24918

What did you expect to see?

It is expected to see steady number of goroutines.

What did you see instead?

Number of goroutines grows infinitely.
Leaked goroutine stacktraces are:

#	0x1243f5f	net/http.http2awaitRequestCancel+0x13f				/usr/local/Cellar/go/1.10/libexec/src/net/http/h2_bundle.go:6780
#	0x127ca8b	net/http.(*http2ClientConn).awaitOpenSlotForRequest.func1+0x3b	/usr/local/Cellar/go/1.10/libexec/src/net/http/h2_bundle.go:7519

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions