-
Notifications
You must be signed in to change notification settings - Fork 36.6k
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
net: Add Clang thread safety annotations for guarded variables in the networking code #13123
Conversation
ec9d07a
to
0287117
Compare
Rebased! |
Imo could squash everything, since most of the commits only touch 2 lines. |
0287117
to
507867a
Compare
@MarcoFalke Rebased and squashed! Please re-review :-) |
507867a
to
36ecc9e
Compare
Rebased and added missing lock:
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
36ecc9e
to
9d944ef
Compare
@MarcoFalke @Empact Updated. Please re-review :-) |
09d46b5
to
d4dd3f9
Compare
@jnewbery I agree that sure looks like an error! Good catch! |
Thanks for the quick reply. I have a PR moving some of those fields around, so I'll get rid of the lock annotations there. |
@jnewbery Thanks a lot for fixing (and finding)! Much appreciated! |
@practicalswift sorry I meant to say that I have a branch that moves the fields around that I haven't PR'ed yet. I'll ping you when the PR is open. |
This locking was mistakenly introduced in PR bitcoin#13123. Related conversation: bitcoin#13123 (comment) Making these fields atomic would ensure safety if multiple RPC accesses them.
…_local_addr_send This locking was mistakenly introduced in PR bitcoin#13123. Related conversation: bitcoin#13123 (comment) Making these fields atomic would ensure safety if multiple RPC accesses them.
…_local_addr_send This locking was mistakenly introduced in PR bitcoin#13123. Related conversation: bitcoin#13123 (comment) Making these fields atomic would ensure safety if multiple RPC accesses them.
…_local_addr_send This locking was mistakenly introduced in PR bitcoin#13123. Related conversation: bitcoin#13123 (comment) Making these fields atomic would ensure safety if multiple RPC accesses them.
…_local_addr_send This locking was mistakenly introduced in PR bitcoin#13123. Related conversation: bitcoin#13123 (comment) Making these fields atomic would ensure safety if multiple RPC accesses them.
…_local_addr_send This locking was mistakenly introduced in PR bitcoin#13123. Related conversation: bitcoin#13123 (comment) Making these fields atomic would ensure safety if multiple RPC accesses them.
m_next_addr_send and m_next_local_addr_send do not need to be guarded by cs_sendProcessing. These fields are only read/writen by the message handling thread and the annotation was added unnecessarily in commit b312cd7. See discussion at bitcoin#13123 (comment). Therefore remove this unnecessary lock annotation.
PR is open here: #21236. It's a pure refactor and should be easy to review. |
m_next_addr_send and m_next_local_addr_send are currently guarded by cs_sendProcessing. These fields are only read/writen by the message handling thread and the annotation was added unnecessarily in commit b312cd7. See discussion at bitcoin#13123 (comment). We add a new m_addr_mutex to guard these fields. Once all the addr relay fields have been moved to the Peer object in net_processing, they will be protected by the same mutex.
zcash: note: more work will be needed to the overall code base in order zcash: for annotations to compile successfully. zcash: cherry picked from commit b312cd7 zcash: bitcoin/bitcoin#13123
zcash: cherry picked from commit 4894133 zcash: bitcoin/bitcoin#13123
zcash: note: more work will be needed to the overall code base in order zcash: for annotations to compile successfully. zcash: cherry picked from commit b312cd7 zcash: bitcoin/bitcoin#13123
zcash: cherry picked from commit 4894133 zcash: bitcoin/bitcoin#13123
…rded variables in the networking code 4894133 Add missing lock in CNode::copyStats(...) (practicalswift) b312cd7 Add missing locking annotations (practicalswift) Pull request description: Add Clang thread safety annotations for variables guarded by: * `cs_addrLocal` * `cs_addrName` * `cs_feeFilter` * `cs_filter` * `cs_hSocket` * `cs_inventory` * `cs_mapLocalHost` * `cs_most_recent_block` * `cs_proxyInfos` * `cs_sendProcessing` * `cs_setBanned` * `cs_SubVer` * `cs_vOneShots` * `cs_vProcessMsg` * `cs_vRecv` * `cs_vSend` Changed files: * `src/net.{cpp,h}` * `src/netbase.cpp` Tree-SHA512: 319a1574a07d766e81fab19b9cfdcf8b5f0b175034ebef220cd406f1672b4ef2c57f5c456c623456ca7a1f96308de69c73535792e9e4c34b848b55fd4f35fc95
…rded variables in the networking code 4894133 Add missing lock in CNode::copyStats(...) (practicalswift) b312cd7 Add missing locking annotations (practicalswift) Pull request description: Add Clang thread safety annotations for variables guarded by: * `cs_addrLocal` * `cs_addrName` * `cs_feeFilter` * `cs_filter` * `cs_hSocket` * `cs_inventory` * `cs_mapLocalHost` * `cs_most_recent_block` * `cs_proxyInfos` * `cs_sendProcessing` * `cs_setBanned` * `cs_SubVer` * `cs_vOneShots` * `cs_vProcessMsg` * `cs_vRecv` * `cs_vSend` Changed files: * `src/net.{cpp,h}` * `src/netbase.cpp` Tree-SHA512: 319a1574a07d766e81fab19b9cfdcf8b5f0b175034ebef220cd406f1672b4ef2c57f5c456c623456ca7a1f96308de69c73535792e9e4c34b848b55fd4f35fc95
Add Clang thread safety annotations for variables guarded by:
cs_addrLocal
cs_addrName
cs_feeFilter
cs_filter
cs_hSocket
cs_inventory
cs_mapLocalHost
cs_most_recent_block
cs_proxyInfos
cs_sendProcessing
cs_setBanned
cs_SubVer
cs_vOneShots
cs_vProcessMsg
cs_vRecv
cs_vSend
Changed files:
src/net.{cpp,h}
src/netbase.cpp