You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently I'm trying to replace sockjs with gorilla/websocket in project kubernetes/dashboard, but there are some error happed, after some trobule shooting with go -race, there are some race condition details:
The dashboard/websocket.(*TerminalSession).Read() is something like this, it almost the same as the code in dashboard:
func (t TerminalSession) Read(p []byte) (int, error) {
mt, message, err := t.WSConn.ReadMessage()
if err != nil {
return 0, err
}
var msg TerminalMessage
if err := json.Unmarshal([]byte(message), &msg); err != nil {
return 0, err
}
switch msg.Op {
case "stdin":
return copy(p, msg.Data), nil
case "resize":
t.SizeChan <- remotecommand.TerminalSize{msg.Cols, msg.Rows}
return 0, nil
default:
return 0, fmt.Errorf("unknown message type '%s'", msg.Op)
}
}```
I try to add a mutex on ReadMessages, but it didn't work. Need some help on this .
The text was updated successfully, but these errors were encountered:
Recently I'm trying to replace sockjs with gorilla/websocket in project kubernetes/dashboard, but there are some error happed, after some trobule shooting with
go -race
, there are some race condition details:The
dashboard/websocket.(*TerminalSession).Read()
is something like this, it almost the same as the code in dashboard:The text was updated successfully, but these errors were encountered: