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

crypto/tls: avoid allocating context.WithCancel on each read/write op #52298

Closed
moredure opened this issue Apr 12, 2022 · 2 comments
Closed

crypto/tls: avoid allocating context.WithCancel on each read/write op #52298

moredure opened this issue Apr 12, 2022 · 2 comments

Comments

@moredure
Copy link
Contributor

moredure commented Apr 12, 2022

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

$ go version
go version go1.18 darwin/arm64

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="arm64"
GOBIN=""
GOCACHE="/Users/mikefaraponov/Library/Caches/go-build"
GOENV="/Users/mikefaraponov/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/mikefaraponov/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/mikefaraponov/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/homebrew/Cellar/go/1.18/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/homebrew/Cellar/go/1.18/libexec/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.18"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/fm/wf4m_47533q_06bcn3vz54500000gn/T/go-build3774033150=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Established connection via tls.Client and doing read/write operations

What did you expect to see?

No context.WithCancel should be allocated on each read/write operation, only on first Handshake

What did you see instead?

Each time I am doing (tls.Conn).Read or (tls.Conn).Write operation context.WithCancel allocated

Possible solution?

#52274 - Check handshake first in Handshake, before trying to create context.WithCancel

@dt
Copy link
Contributor

dt commented Apr 13, 2022

Is this a duplicate of #50657 ?

@moredure
Copy link
Contributor Author

@dt indeed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants