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
addrman: Add missing lock in Clear() (CAddrMan) #11585
addrman: Add missing lock in Clear() (CAddrMan) #11585
Conversation
The variable vRandom is guarded by the mutex cs.
Thanks for the quick review @promag! @promag, you mean that all of the following should be guarded by
|
That is what Line 185 in 8335cb4
cs .
|
@promag I'll investigate! :-) |
@promag You're right! The locking seems to be correct for the other |
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.
utACK 3ab545d. CAddrMan::Clear is only called during initialization (during construction and deserialization) so it seems safe to add this lock. It would be good if the critical section comment was clearer about whether a lock is needed to access all class members or just some:
Line 185 in 8335cb4
//! critical section to protect the inner data structures |
@theuni probably knows more
utACK 3ab545d. I believe the intention is for all public methods to lock the cs, and the privates ones don't need to. That would imply that all vars should be covered under the cs. |
utACK 3ab545d |
3ab545d addrman: Add missing lock in Clear() (CAddrMan) (practicalswift) Pull request description: Add missing lock in `Clear()` (`CAddrMan`). The variable `vRandom` is guarded by the mutex `cs`. **Note to reviewers:** Does this look correct? Should the lock cover the entire scope of the method, or should it be limited to cover only `std::vector<int>().swap(vRandom);`? Tree-SHA512: 8833f31beaed1728fa55b13ddf9e0b8e24e395931497329be2440ce1c5113ff02871707d40830260adabd30c4ea86088f5da5cf8a821150c0d820f50a2ce386a
3ab545d addrman: Add missing lock in Clear() (CAddrMan) (practicalswift) Pull request description: Add missing lock in `Clear()` (`CAddrMan`). The variable `vRandom` is guarded by the mutex `cs`. **Note to reviewers:** Does this look correct? Should the lock cover the entire scope of the method, or should it be limited to cover only `std::vector<int>().swap(vRandom);`? Tree-SHA512: 8833f31beaed1728fa55b13ddf9e0b8e24e395931497329be2440ce1c5113ff02871707d40830260adabd30c4ea86088f5da5cf8a821150c0d820f50a2ce386a
3ab545d addrman: Add missing lock in Clear() (CAddrMan) (practicalswift) Pull request description: Add missing lock in `Clear()` (`CAddrMan`). The variable `vRandom` is guarded by the mutex `cs`. **Note to reviewers:** Does this look correct? Should the lock cover the entire scope of the method, or should it be limited to cover only `std::vector<int>().swap(vRandom);`? Tree-SHA512: 8833f31beaed1728fa55b13ddf9e0b8e24e395931497329be2440ce1c5113ff02871707d40830260adabd30c4ea86088f5da5cf8a821150c0d820f50a2ce386a
3ab545d addrman: Add missing lock in Clear() (CAddrMan) (practicalswift) Pull request description: Add missing lock in `Clear()` (`CAddrMan`). The variable `vRandom` is guarded by the mutex `cs`. **Note to reviewers:** Does this look correct? Should the lock cover the entire scope of the method, or should it be limited to cover only `std::vector<int>().swap(vRandom);`? Tree-SHA512: 8833f31beaed1728fa55b13ddf9e0b8e24e395931497329be2440ce1c5113ff02871707d40830260adabd30c4ea86088f5da5cf8a821150c0d820f50a2ce386a
3ab545d addrman: Add missing lock in Clear() (CAddrMan) (practicalswift) Pull request description: Add missing lock in `Clear()` (`CAddrMan`). The variable `vRandom` is guarded by the mutex `cs`. **Note to reviewers:** Does this look correct? Should the lock cover the entire scope of the method, or should it be limited to cover only `std::vector<int>().swap(vRandom);`? Tree-SHA512: 8833f31beaed1728fa55b13ddf9e0b8e24e395931497329be2440ce1c5113ff02871707d40830260adabd30c4ea86088f5da5cf8a821150c0d820f50a2ce386a
3ab545d addrman: Add missing lock in Clear() (CAddrMan) (practicalswift) Pull request description: Add missing lock in `Clear()` (`CAddrMan`). The variable `vRandom` is guarded by the mutex `cs`. **Note to reviewers:** Does this look correct? Should the lock cover the entire scope of the method, or should it be limited to cover only `std::vector<int>().swap(vRandom);`? Tree-SHA512: 8833f31beaed1728fa55b13ddf9e0b8e24e395931497329be2440ce1c5113ff02871707d40830260adabd30c4ea86088f5da5cf8a821150c0d820f50a2ce386a
3ab545d addrman: Add missing lock in Clear() (CAddrMan) (practicalswift) Pull request description: Add missing lock in `Clear()` (`CAddrMan`). The variable `vRandom` is guarded by the mutex `cs`. **Note to reviewers:** Does this look correct? Should the lock cover the entire scope of the method, or should it be limited to cover only `std::vector<int>().swap(vRandom);`? Tree-SHA512: 8833f31beaed1728fa55b13ddf9e0b8e24e395931497329be2440ce1c5113ff02871707d40830260adabd30c4ea86088f5da5cf8a821150c0d820f50a2ce386a
3ab545d addrman: Add missing lock in Clear() (CAddrMan) (practicalswift) Pull request description: Add missing lock in `Clear()` (`CAddrMan`). The variable `vRandom` is guarded by the mutex `cs`. **Note to reviewers:** Does this look correct? Should the lock cover the entire scope of the method, or should it be limited to cover only `std::vector<int>().swap(vRandom);`? Tree-SHA512: 8833f31beaed1728fa55b13ddf9e0b8e24e395931497329be2440ce1c5113ff02871707d40830260adabd30c4ea86088f5da5cf8a821150c0d820f50a2ce386a
3ab545d addrman: Add missing lock in Clear() (CAddrMan) (practicalswift) Pull request description: Add missing lock in `Clear()` (`CAddrMan`). The variable `vRandom` is guarded by the mutex `cs`. **Note to reviewers:** Does this look correct? Should the lock cover the entire scope of the method, or should it be limited to cover only `std::vector<int>().swap(vRandom);`? Tree-SHA512: 8833f31beaed1728fa55b13ddf9e0b8e24e395931497329be2440ce1c5113ff02871707d40830260adabd30c4ea86088f5da5cf8a821150c0d820f50a2ce386a
3ab545d addrman: Add missing lock in Clear() (CAddrMan) (practicalswift) Pull request description: Add missing lock in `Clear()` (`CAddrMan`). The variable `vRandom` is guarded by the mutex `cs`. **Note to reviewers:** Does this look correct? Should the lock cover the entire scope of the method, or should it be limited to cover only `std::vector<int>().swap(vRandom);`? Tree-SHA512: 8833f31beaed1728fa55b13ddf9e0b8e24e395931497329be2440ce1c5113ff02871707d40830260adabd30c4ea86088f5da5cf8a821150c0d820f50a2ce386a
3ab545d addrman: Add missing lock in Clear() (CAddrMan) (practicalswift) Pull request description: Add missing lock in `Clear()` (`CAddrMan`). The variable `vRandom` is guarded by the mutex `cs`. **Note to reviewers:** Does this look correct? Should the lock cover the entire scope of the method, or should it be limited to cover only `std::vector<int>().swap(vRandom);`? Tree-SHA512: 8833f31beaed1728fa55b13ddf9e0b8e24e395931497329be2440ce1c5113ff02871707d40830260adabd30c4ea86088f5da5cf8a821150c0d820f50a2ce386a
* New user params * no splash fix * no splash fix * Update Ocean_all_cd.yml until openssl and python2 breaking changes fixes are finalized actions/runner-images#1811 (comment) * + CountBits in crypto/common.h Return the smallest number n such that (x >> n) == 0 (or 64 if the highest bit in x is set DeckerSU/KomodoOcean@d836179 * Add asmap utility which queries a mapping The scripts for creating a compact IP->ASN mapping are here: https://github.com/sipa/asmap bitcoin/bitcoin@8feb4e4 DeckerSU/KomodoOcean@50daf84 * p2p: supplying and using asmap to improve IP bucketing in addrman first approach to porting bitcoin/bitcoin#16702 into old v0.13 codebase. DeckerSU/KomodoOcean@bfaf287 * Return mapped AS in RPC call getpeerinfo and in GUI DeckerSU/KomodoOcean@81d10f5 * Addrman Google Tests Note: these are standart tests, which is not include asmap features. DeckerSU/KomodoOcean@2173036 * add legacy and asmap addrman tests DeckerSU/KomodoOcean@7567965 * when clearing addrman clear mapInfo and mapAddr bitcoin/bitcoin@b86a420 DeckerSU/KomodoOcean@9b2c1f3 * add addrman serialization test DeckerSU/KomodoOcean@18ebbd5 * addrman: Add missing lock in Clear() (CAddrMan) bitcoin/bitcoin#11585 DeckerSU/KomodoOcean@b81d07b * gui: debug window -> tab peers elems re-arrange added scroll area for detailed peer info, added splitter between detailed info and peer table DeckerSU/KomodoOcean@be106ed * depends: tar: Always extract as yourself For normal users, --no-same-owner is default, but not so for root, where it is assumed that root can change ownership willy-nilly. This is not the case for privilege-limited container environments where we gaslight the process into thinking it's root. KomodoPlatform/komodo#368 bitcoin/bitcoin@89bee1b DeckerSU/KomodoOcean@85d2fa6 * refactor: remove unused header var in GetBlockProof DeckerSU/KomodoOcean@a1be01c * bump versions CLIENT_VERSION 4.0.2 KOMODO_VERSION 0.6.1 * add display service bits for NSPV, ADDRINDEX and SPENTINDEX DeckerSU/KomodoOcean@f0ef3e2 * optional disable nspv nSPV processing is disabled by default for Komodo-Qt, to enable it you can alsways use `-nspv_msg` command line arg. KomodoPlatform/komodo#382 DeckerSU/KomodoOcean@1d1e568 * update getblocktemplate conditions DeckerSU/KomodoOcean@506bc22 * update IsNotInSync() conditions IsNotInSync() using now only in waitForPeers() which is called in VerusStaker(...) and BitcoinMiner_noeq(...), mean which used only in verushash-algo based mining and staking chains. DeckerSU/KomodoOcean@cb5dec1 * fetch bdb using https instead of http DeckerSU/KomodoOcean@d09c03a * remove auto-created file (cryptoconditions/compile) to resolve issues with compiling dirty releases from unchanged repo. DeckerSU/KomodoOcean@3e4aa66
87e33eb addrman: Add missing lock in Clear() (CAddrMan) (practicalswift) Pull request description: Straightforward cherry-pick from bitcoin#11585 ACKs for top commit: furszy: utACK 87e33eb Fuzzbawls: utACK 87e33eb Tree-SHA512: a35ae05c141d0b29d834045aa7496a72469fc9d439175c1706c4f20283a6e51d234e2f0ee38d049a16fcad7cd882c5d55ef54b93e2ba47f99c580315b0eacbaf
The variable vRandom is guarded by the mutex cs. zcash: cherry picked from commit 3ab545d zcash: bitcoin/bitcoin#11585
Bitcoin 0.16 locking PRs These are locking changes from upstream (bitcoin core) release 0.16 (Aug 14, 2017, to Feb 16, 2018), oldest to newest (when merged to the master branch). Each commit also includes a reference both to the PR and the upstream commit. - bitcoin/bitcoin#11126 - Excludes changes to wallet tests that we don't have. - bitcoin/bitcoin#10916 - first commit only; second commit already merged by d9fcc2b - bitcoin/bitcoin#11107 - Only the last commit. - bitcoin/bitcoin#11593 - bitcoin/bitcoin#11585 - bitcoin/bitcoin#11618 - bitcoin/bitcoin#10286 - Only the third and last commits. - bitcoin/bitcoin#11870 - bitcoin/bitcoin#12330 - bitcoin/bitcoin#12366 - bitcoin/bitcoin#12368 - bitcoin/bitcoin#12333 - Only the first commit.
3ab545d addrman: Add missing lock in Clear() (CAddrMan) (practicalswift) Pull request description: Add missing lock in `Clear()` (`CAddrMan`). The variable `vRandom` is guarded by the mutex `cs`. **Note to reviewers:** Does this look correct? Should the lock cover the entire scope of the method, or should it be limited to cover only `std::vector<int>().swap(vRandom);`? Tree-SHA512: 8833f31beaed1728fa55b13ddf9e0b8e24e395931497329be2440ce1c5113ff02871707d40830260adabd30c4ea86088f5da5cf8a821150c0d820f50a2ce386a
3ab545d addrman: Add missing lock in Clear() (CAddrMan) (practicalswift) Pull request description: Add missing lock in `Clear()` (`CAddrMan`). The variable `vRandom` is guarded by the mutex `cs`. **Note to reviewers:** Does this look correct? Should the lock cover the entire scope of the method, or should it be limited to cover only `std::vector<int>().swap(vRandom);`? Tree-SHA512: 8833f31beaed1728fa55b13ddf9e0b8e24e395931497329be2440ce1c5113ff02871707d40830260adabd30c4ea86088f5da5cf8a821150c0d820f50a2ce386a
Add missing lock in
Clear()
(CAddrMan
).The variable
vRandom
is guarded by the mutexcs
.Note to reviewers: Does this look correct? Should the lock cover the entire scope of the method, or should it be limited to cover only
std::vector<int>().swap(vRandom);
?