-
Notifications
You must be signed in to change notification settings - Fork 20.8k
ethstats: avoid concurrent write on websocket, fixes #21403 #21404
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
Conversation
b4b2e7f
to
6d65dd7
Compare
From https://godoc.org/github.com/gorilla/websocket#hdr-Concurrency :
Looks like we need one mutex (one for writes, one for reads) |
Fixed by using the same mutex for both reads and writes. The particular optimization to allow concurrent reading/writing is not important for this code. |
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.
The locking looks a bit scary. I'd be much happier if we just made a wrapper struct for the connection that exposes ReadJSON, WriteJSON and Close methods. You could then do the locking in ReadJSON and WriteJSON.
Yup, good call, will fix |
Fixed, PTAL |
Description Improve reliability from the ethstats module The connectionWrapper was cherrypicked from go-ethereum upstream: ethereum/go-ethereum@82a9e11 (ethereum/go-ethereum#21404) Other changes Validator injecting its version to the proxy stats chunk Tested Manually in a local testnet Related issues Fixes #1395 Fixes #1397 Backwards compatibility Yes
Description Improve reliability from the ethstats module The connectionWrapper was cherrypicked from go-ethereum upstream: ethereum/go-ethereum@82a9e11 (ethereum/go-ethereum#21404) Other changes Validator injecting its version to the proxy stats chunk Tested Manually in a local testnet Related issues Fixes #1395 Fixes #1397 Backwards compatibility Yes
* Celostats reliability (#1487) Description Improve reliability from the ethstats module The connectionWrapper was cherrypicked from go-ethereum upstream: ethereum/go-ethereum@82a9e11 (ethereum/go-ethereum#21404) Other changes Validator injecting its version to the proxy stats chunk Tested Manually in a local testnet Related issues Fixes #1395 Fixes #1397 Backwards compatibility Yes * Skip GPM and other checks for transactions whose gas limit exceeds what's left in the block * Change default tx pool GlobalSlots back to 4096. The decrease to 2048 was due to inefficiencies in the tx pool which have now been fixed, so this sets it back to its original value. * Release v1.3.0-beta.3 Co-authored-by: Gaston Ponti <pontigaston@gmail.com>
See #21403 for more details. This PR adds a mutex around the writes