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

[Question]: Websocket log expected error #1243

Open
cyrnicolase opened this issue Mar 25, 2024 · 3 comments
Open

[Question]: Websocket log expected error #1243

cyrnicolase opened this issue Mar 25, 2024 · 3 comments
Labels
question Further information is requested

Comments

@cyrnicolase
Copy link
Contributor

cyrnicolase commented Mar 25, 2024

The net.ErrClosed maybe an expected error after svrConn.Close(), clntConn.Close().

However, I am now encountering numerous instances of such errors websocketproxy#wsproxy#main: failed to read from client: failed to get reader: use of closed network connection.

@cyrnicolase cyrnicolase added the question Further information is requested label Mar 25, 2024
@suchen-sci
Copy link
Contributor

			t, m, err := clntConn.Read(stdctx.Background())
			if err != nil {
				if cs := websocket.CloseStatus(err); cs == websocket.StatusNormalClosure {
					svrConn.Close(websocket.StatusNormalClosure, "")
				} else {
					svrConn.Close(cs, err.Error())
					logger.Errorf("%s: failed to read from client: %v", sp.Name, err)
				}
				break
			}

By the code and this issue of our websocket pkg nhooyr/websocket#439.

I think maybe the client side of websocket is not closed by using websocket StatusNormalClosure?

@cyrnicolase
Copy link
Contributor Author

Yes you are right, but I have to accommodate these errors

@cyrnicolase
Copy link
Contributor Author

Me again.

Today I spoke with our iOS development engineers, and after their confirmation, they are using the disconnect() method provided by the SDK, which by default passes websocket.StatusNormalClosure.

And I get websocketproxy#wsproxy#main: failed to read from server: failed to get reader: received close frame: status = StatusNoStatusRcvd and reason = ""

And when I use apifox test it, I get {"level":"ERROR","time":"2024-04-02T03:24:58.978Z","caller":"httpproxy/wspool.go:285","message":"websocketproxy#wsproxy#main: failed to read from server: failed to get reader: received close frame: status = StatusNoStatusRcvd and reason = \"\""}, {"level":"ERROR","time":"2024-04-02T03:24:58.979Z","caller":"httpproxy/wspool.go:257","message":"websocketproxy#wsproxy#main: failed to read from client: failed to get reader: received close frame: status = StatusNoStatusRcvd and reason = \"\""}

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

No branches or pull requests

2 participants