-
Notifications
You must be signed in to change notification settings - Fork 220
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
Small race fixes #186
Small race fixes #186
Conversation
v2/websocket/transport.go
Outdated
case <- w.quit: // ws closed | ||
return | ||
case message := <- w.writeChan: | ||
err := w.ws.WriteMessage(websocket.TextMessage, message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error handling is missed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oppps, good spot. This line needs to removed completely as ws.Write
is used instead a few lines down
v2/websocket/transport.go
Outdated
@@ -85,8 +90,9 @@ func (w *ws) Send(ctx context.Context, msg interface{}) error { | |||
return fmt.Errorf("websocket connection closed") | |||
default: | |||
} | |||
w.log.Debug("ws->srv: %s", string(bs)) | |||
err = w.ws.WriteMessage(websocket.TextMessage, bs) | |||
w.log.Info("ws->srv: %s", string(bs)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it make sense to keep it under debug level?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep good point, changing back to debug
Seems like the change affected the v2 integration tests. |
Checking now |
a00cda1
to
9ff7baa
Compare
9ff7baa
to
7765a92
Compare
@JacobPlaster thank you. The code looks good to me. I ran a few tests and found a corner case. Enabling order book checksum verification leads to another data race. Pasting more details:
|
Thanks @andreygrehov, the help is appreciated! The above error was found without using this PR fix right? I've tested this version out quite a lot and cant seem to reproduce any race conditions |
@JacobPlaster I tested your branch. Let me double-check. |
@JacobPlaster apologies. I indeed mistested it. No more races. |
No problem, thanks again |
Description:
There are a few race conditions which seemed to have snook in with the introduction to the mulit-websocket connection multiplexer. This pull request addresses those race conditions which were found using
go run -race
.Breaking changes:
New features:
None
Fixes:
PR status: