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

wsclient: Unexpected error while receiving:read ... use of closed network connection #163

Closed
srikanthccv opened this issue Mar 21, 2023 · 1 comment · Fixed by #213
Closed
Labels
help wanted Extra attention is needed

Comments

@srikanthccv
Copy link
Member

When ws client is stopped, it closes the connection here

c.connMutex.RLock()
conn := c.conn
c.connMutex.RUnlock()
if conn != nil {
_ = conn.Close()
}
and cancels the context
c.isStoppingMutex.Lock()
cancelFunc := c.runCancel
c.isStoppingFlag = true
c.isStoppingMutex.Unlock()
cancelFunc()
And the ReceiverLoop tries to read a message from the closed connection resulting in an error.

Unexpected error while receiving: read tcp 127.0.0.1:53775->127.0.0.1:53774: use of closed network connection
@portertech
Copy link

Running into this one consistently:

2023-11-22T22:18:00.217-0800    ERROR   internal/wsreceiver.go:53       Unexpected error while receiving: read tcp 127.0.0.1:33992->127.0.0.1:4320: use of closed network connection
github.com/open-telemetry/opamp-go/client/internal.(*wsReceiver).ReceiverLoop
        /home/portertech/go/pkg/mod/github.com/open-telemetry/opamp-go@v0.10.0/client/internal/wsreceiver.go:53
github.com/open-telemetry/opamp-go/client.(*wsClient).runOneCycle
        /home/portertech/go/pkg/mod/github.com/open-telemetry/opamp-go@v0.10.0/client/wsclient.go:244
github.com/open-telemetry/opamp-go/client.(*wsClient).runUntilStopped
        /home/portertech/go/pkg/mod/github.com/open-telemetry/opamp-go@v0.10.0/client/wsclient.go:266
github.com/open-telemetry/opamp-go/client/internal.(*ClientCommon).StartConnectAndRun.func1
        /home/portertech/go/pkg/mod/github.com/open-telemetry/opamp-go@v0.10.0/client/internal/clientcommon.go:199

tigrannajaryan added a commit that referenced this issue Mar 26, 2024
Resolves #163 

Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com>
Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
Co-authored-by: Tigran Najaryan <4194920+tigrannajaryan@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
3 participants