nvmd / bitcoin

Bitcoin Core integration/staging tree
https://bitcoin.org/en/download
MIT License
0 stars 0 forks source link

bitcoin-opencon thread uses 100% CPU under certain circumstances with low peer availability / number of peers / seeds #3

Open nvmd opened 9 years ago

nvmd commented 9 years ago

Seem to spend a lot of time in the loop of the second case ("use new nodes") of CAddrMan::Select_() (addrman.cpp) called from ThreadOpenConnections (net.cpp). Regression was introduced in pull request #5941 – fixed size vvNew and vvTried make us spend a lot of time selecting non-empty position (i.e. the position with peer address) when actual peer number is significantly less than ADDRMAN_NEW_BUCKET_COUNT*ADDRMAN_BUCKET_SIZE. Moreover, position selection is an expensive operation as it uses secure random number generation involving OpenSSL. Issue #1664 is probably related too, or at least the safe buggy behavior can be expected.

rebroad commented 7 years ago

Did you mean to raise this issue on the bitcoin project rather than your own fork?

nvmd commented 7 years ago

@rebroad yes, it was meant to be raised on bitcoin/bitcoin project of course. I use this repo as a staging area, I just wasn't sure I've formulated the issue good enough to submit it back then (it seems to be good enough for me now, though). Not sure this issue is still present in the bitcoin.