What version of Go are you using (go version)?
$ go version
go version go1.13.3 linux/amd64
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/root/go"
GOPRIVATE=""
GOPROXY="direct"
GOROOT="/usr/lib/golang"
GOSUMDB="off"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/golang/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
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-build531877332=/tmp/go-build -gno-record-gcc-switches"
What did you do?
I make a https server using golang。Server waited a long time in tls handshake phase,becouse
many clients didn't send hello to server。One day later, my server goroutine count Increase to a huge number(hundreds thousand level)。
I try different frameworks or library(net/http,fasthttp,gin) and set the readtimeout,but didn't solve this problem.
goroutine 627 [IO wait, 36 minutes]:
internal/poll.runtime_pollWait(0x7f6d0fc44728, 0x72, 0xffffffffffffffff)
C:/Go1.13/src/runtime/netpoll.go:184 +0x55
internal/poll.(*pollDesc).wait(0xc000223898, 0x72, 0x200, 0x205, 0xffffffffffffffff)
C:/Go1.13/src/internal/poll/fd_poll_runtime.go:87 +0x45
internal/poll.(*pollDesc).waitRead(...)
C:/Go1.13/src/internal/poll/fd_poll_runtime.go:92
internal/poll.(*FD).Read(0xc000223880, 0xc000334480, 0x205, 0x205, 0x0, 0x0, 0x0)
C:/Go1.13/src/internal/poll/fd_unix.go:169 +0x1cf
net.(*netFD).Read(0xc000223880, 0xc000334480, 0x205, 0x205, 0x203000, 0x42e7c1, 0xb98f38)
C:/Go1.13/src/net/fd_unix.go:202 +0x4f
net.(*conn).Read(0xc00000e898, 0xc000334480, 0x205, 0x205, 0x0, 0x0, 0x0)
C:/Go1.13/src/net/net.go:184 +0x68
crypto/tls.(*atLeastReader).Read(0xc0002a9ce0, 0xc000334480, 0x205, 0x205, 0xc000334480, 0x0, 0xc000551450)
C:/Go1.13/src/crypto/tls/conn.go:782 +0x60
bytes.(*Buffer).ReadFrom(0xc000508958, 0xc60fc0, 0xc0002a9ce0, 0x40a1d5, 0xab40a0, 0xb3daa0)
C:/Go1.13/src/bytes/buffer.go:204 +0xb4
crypto/tls.(*Conn).readFromUntil(0xc000508700, 0xc61e80, 0xc00000e898, 0x5, 0xc00000e898, 0x0)
C:/Go1.13/src/crypto/tls/conn.go:804 +0xec
crypto/tls.(*Conn).readRecordOrCCS(0xc000508700, 0x100, 0xc61180, 0xc00001e050)
C:/Go1.13/src/crypto/tls/conn.go:609 +0x17c
crypto/tls.(*Conn).readRecord(...)
C:/Go1.13/src/crypto/tls/conn.go:577
crypto/tls.(*Conn).readHandshake(0xc000508700, 0x0, 0x0, 0xc61180, 0xc00001e050)
C:/Go1.13/src/crypto/tls/conn.go:995 +0x6d
crypto/tls.(*Conn).readClientHello(0xc000508700, 0x0, 0xc61180, 0xc00001e050)
C:/Go1.13/src/crypto/tls/handshake_server.go:135 +0x40
crypto/tls.(*Conn).serverHandshake(0xc000508700, 0x0, 0x0)
C:/Go1.13/src/crypto/tls/handshake_server.go:43 +0x70
crypto/tls.(*Conn).Handshake(0xc000508700, 0x0, 0x0)
C:/Go1.13/src/crypto/tls/conn.go:1366 +0x23a
github.com/valyala/fasthttp.(*Server).getNextProto(0xc000180e00, 0xc76040, 0xc000508700, 0x0, 0x0, 0xc61180, 0xc00001e050)
C:/Users/Administrator/go/src/github.com/valyala/fasthttp/server.go:1338 +0xbf
github.com/valyala/fasthttp.(*Server).serveConn(0xc000180e00, 0xc76040, 0xc000508700, 0x0, 0x0)
C:/Users/Administrator/go/src/github.com/valyala/fasthttp/server.go:1843 +0xbf
github.com/valyala/fasthttp.(*workerPool).workerFunc(0xc0001df180, 0xc0002a8780)
C:/Users/Administrator/go/src/github.com/valyala/fasthttp/workerpool.go:223 +0xc0
github.com/valyala/fasthttp.(*workerPool).getCh.func1(0xc0001df180, 0xc0002a8780, 0xa511a0, 0xc0002a8780)
C:/Users/Administrator/go/src/github.com/valyala/fasthttp/workerpool.go:195 +0x35
created by github.com/valyala/fasthttp.(*workerPool).getCh
C:/Users/Administrator/go/src/github.com/valyala/fasthttp/workerpool.go:194 +0x101
What did you expect to see?
I hope the handshake timeout could be add in crypto/tls。
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env)?go envOutputWhat did you do?
I make a https server using golang。Server waited a long time in tls handshake phase,becouse
many clients didn't send hello to server。One day later, my server goroutine count Increase to a huge number(hundreds thousand level)。
I try different frameworks or library(net/http,fasthttp,gin) and set the readtimeout,but didn't solve this problem.
goroutine 627 [IO wait, 36 minutes]:
internal/poll.runtime_pollWait(0x7f6d0fc44728, 0x72, 0xffffffffffffffff)
C:/Go1.13/src/runtime/netpoll.go:184 +0x55
internal/poll.(*pollDesc).wait(0xc000223898, 0x72, 0x200, 0x205, 0xffffffffffffffff)
C:/Go1.13/src/internal/poll/fd_poll_runtime.go:87 +0x45
internal/poll.(*pollDesc).waitRead(...)
C:/Go1.13/src/internal/poll/fd_poll_runtime.go:92
internal/poll.(*FD).Read(0xc000223880, 0xc000334480, 0x205, 0x205, 0x0, 0x0, 0x0)
C:/Go1.13/src/internal/poll/fd_unix.go:169 +0x1cf
net.(*netFD).Read(0xc000223880, 0xc000334480, 0x205, 0x205, 0x203000, 0x42e7c1, 0xb98f38)
C:/Go1.13/src/net/fd_unix.go:202 +0x4f
net.(*conn).Read(0xc00000e898, 0xc000334480, 0x205, 0x205, 0x0, 0x0, 0x0)
C:/Go1.13/src/net/net.go:184 +0x68
crypto/tls.(*atLeastReader).Read(0xc0002a9ce0, 0xc000334480, 0x205, 0x205, 0xc000334480, 0x0, 0xc000551450)
C:/Go1.13/src/crypto/tls/conn.go:782 +0x60
bytes.(*Buffer).ReadFrom(0xc000508958, 0xc60fc0, 0xc0002a9ce0, 0x40a1d5, 0xab40a0, 0xb3daa0)
C:/Go1.13/src/bytes/buffer.go:204 +0xb4
crypto/tls.(*Conn).readFromUntil(0xc000508700, 0xc61e80, 0xc00000e898, 0x5, 0xc00000e898, 0x0)
C:/Go1.13/src/crypto/tls/conn.go:804 +0xec
crypto/tls.(*Conn).readRecordOrCCS(0xc000508700, 0x100, 0xc61180, 0xc00001e050)
C:/Go1.13/src/crypto/tls/conn.go:609 +0x17c
crypto/tls.(*Conn).readRecord(...)
C:/Go1.13/src/crypto/tls/conn.go:577
crypto/tls.(*Conn).readHandshake(0xc000508700, 0x0, 0x0, 0xc61180, 0xc00001e050)
C:/Go1.13/src/crypto/tls/conn.go:995 +0x6d
crypto/tls.(*Conn).readClientHello(0xc000508700, 0x0, 0xc61180, 0xc00001e050)
C:/Go1.13/src/crypto/tls/handshake_server.go:135 +0x40
crypto/tls.(*Conn).serverHandshake(0xc000508700, 0x0, 0x0)
C:/Go1.13/src/crypto/tls/handshake_server.go:43 +0x70
crypto/tls.(*Conn).Handshake(0xc000508700, 0x0, 0x0)
C:/Go1.13/src/crypto/tls/conn.go:1366 +0x23a
github.com/valyala/fasthttp.(*Server).getNextProto(0xc000180e00, 0xc76040, 0xc000508700, 0x0, 0x0, 0xc61180, 0xc00001e050)
C:/Users/Administrator/go/src/github.com/valyala/fasthttp/server.go:1338 +0xbf
github.com/valyala/fasthttp.(*Server).serveConn(0xc000180e00, 0xc76040, 0xc000508700, 0x0, 0x0)
C:/Users/Administrator/go/src/github.com/valyala/fasthttp/server.go:1843 +0xbf
github.com/valyala/fasthttp.(*workerPool).workerFunc(0xc0001df180, 0xc0002a8780)
C:/Users/Administrator/go/src/github.com/valyala/fasthttp/workerpool.go:223 +0xc0
github.com/valyala/fasthttp.(*workerPool).getCh.func1(0xc0001df180, 0xc0002a8780, 0xa511a0, 0xc0002a8780)
C:/Users/Administrator/go/src/github.com/valyala/fasthttp/workerpool.go:195 +0x35
created by github.com/valyala/fasthttp.(*workerPool).getCh
C:/Users/Administrator/go/src/github.com/valyala/fasthttp/workerpool.go:194 +0x101
What did you expect to see?
I hope the handshake timeout could be add in crypto/tls。