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/sync/singleflight: runtime.Goexit blocks waiting channels forever #67087

Closed
abursavich opened this issue Apr 27, 2024 · 1 comment
Closed
Milestone

Comments

@abursavich
Copy link

abursavich commented Apr 27, 2024

Go version

go version go1.22.2 darwin/arm64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/amb/Library/Caches/go-build'
GOENV='/Users/amb/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/amb/go/pkg/mod'
GONOPROXY='github.com/REDACTED/*'
GONOSUMDB='github.com/REDACTED/*'
GOOS='darwin'
GOPATH='/Users/amb/go'
GOPRIVATE='github.com/REDACTED/*'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.22.2'
GCCGO='gccgo'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users/amb/src/singleflight/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/p4/t2ydl1qj10s99sfykmbnp6cc0000gq/T/go-build239865489=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

Example with panic: https://go.dev/play/p/fKxw87DNRY6
Example with runtime.Goexit: https://go.dev/play/p/PJIOUMA4eTc

What did you see happen?

I'm forking singleflight to add contexts and generics and noticed an inconsistent behavior. You may or may not consider it a bug.

The package goes out of its way to make panics unrecoverable when using DoChan specifically so that any waiting channels won't be blocked forever. The package also goes out of its way to handle runtime.Goexit when using Do but it does nothing to unblock DoChan channels that are waiting when this happens.

What did you expect to see?

I don't have a strong opinion about what the right thing to do is here. I might suggest closing the channels without sending a result, but it's specifically documented that the channel won't be closed. I'm leaning toward sending the errGoexit error to those channels, but I'm not really happy with that either.

@gopherbot gopherbot added this to the Unreleased milestone Apr 27, 2024
@seankhliao
Copy link
Member

Duplicate of #52557

@seankhliao seankhliao marked this as a duplicate of #52557 Apr 27, 2024
@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Apr 27, 2024
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

3 participants