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/exp/jsonrpc2: end of connection can be never detected #56131

Closed
maxatome opened this issue Oct 10, 2022 · 1 comment
Closed

x/exp/jsonrpc2: end of connection can be never detected #56131

maxatome opened this issue Oct 10, 2022 · 1 comment
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@maxatome
Copy link

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

$ go version
go version go1.19.1 freebsd/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="/home/xxx/.cache/go-build"
GOENV="/home/xxx/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="freebsd"
GOINSECURE=""
GOMODCACHE="/home/xxx/go/pkg/mod"
GOOS="freebsd"
GOPATH="/home/xxx/go"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go119"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go119/pkg/tool/freebsd_amd64"
GOVCS=""
GOVERSION="go1.19.1"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="cc"
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 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1731022611=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Try to monitor the end of a connection using the golang.org/x/exp/jsonrpc2.Binder interface:

func (s *MyServer) Bind(ctx context.Context, conn *jsonrpc2.Connection) (jsonrpc2.ConnectionOptions, error) {
    // XXX register conn in *MyServer

    // monitor the end of the connection
    go func() {
        conn.Wait()
        conn.Close()
        // YYY do some cleanup in *MyServer
    }()
    return jsonrpc2.ConnectionOptions{}, nil
}

What did you expect to see?

The // YYY do some cleanup in *MyServer is reached for each end of connection.

What did you see instead?

Sometimes conn.Wait() blocks forever.

https://go-review.googlesource.com/c/exp/+/436888 fixes this issue.

@maxatome maxatome changed the title exp/jsonrpc2: end of connection can be never detected x/exp/jsonrpc2: end of connection can be never detected Oct 10, 2022
@gopherbot gopherbot added this to the Unreleased milestone Oct 10, 2022
@joedian joedian added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Oct 14, 2022
@maxatome
Copy link
Author

@golang golang locked and limited conversation to collaborators Oct 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants