Closed verdy-p closed 2 years ago
Why are you opening bug reports for bitcoin core on this repository.
Why are you opening bug reports for bitcoin core on this repository.
Because this is THIS repository for Bitcoin Core and there's no other support to signal such bug.
But I reproduce this bug again as well with the development version compiled from this Git repository !!!
Why don't you admit this IS a real bug that is occuring VERY often and is VERY EASY to reproduce by just using it normally (without any tweak)? May be it does not affect everyone, but specific nodes are targetted to stall/crash them.
This is the repository for the website. Report Bitcoin Core bugs to https://github.com/bitcoin/bitcoin.
Stale chain tips can block the RPC and all other responses from the peer for very long time (more than 15 minutes, sometimes hours, or undefinetely). During that time I can see that my local node no longer replies to ANY other peer (e.g. to bitnode.io core). And in process viewers, I can see that there's a single thread blocking ALL other threads in a tight loop using 100% CPU in a tight loop.
I've seen that this is occurs in any db indexer (notably the chainstate indexer during IBD, or the txindexer, or the coinstat db indexer), notably in some critical steps where new blocks are added to the chain (once every about 15 minutes). This seems to happen when a new block contains a transaction validating a better chain, and invalidating other blocks from dead branches. In that case, the ongoin indexer will fail with unchecked conditions in its internal iterator, apparently because it expect the next block to be present and locks it incorrectly, and is not able to release it and retry if that next valid block has been replaced by a better block in the chain.
Finally later it may eventually detect that and detect the inconsistency, by eviting some peers.
And here again we see the deadlock occuring for long time in the coindbindexer.
It seems then that there are malicious nodes on the P2P network sending bad blocks that "partially pass" the basic security, but can cause BitCoin Core to be blocked and become unresponsive. It can no longer respond even to a basic RPC such as "bitcoin -getinfo", or "bitcoin -netinfo"
It will not even repond to a "bitcoin-cli stop": some threads are stopped, but not all, and the indexer thread is still running in its tight loop; if you are in that situation, the only way to recover is to KILL the process entirely, and you'll get the related index to become invalid as it was not committed, it will have to be reconstructed from zero.
Most often, you have no way to recover (given that the RPC service is not responsive, and even the CTRL+C breaker, or a simple kill -hangup" will not work. You have to do an instant kill (kill -9 on Linux, or manual kill in the Process Viewer on Windows: nothing else will be synced to disk).
If the index was the IBD index, the chainstate can only be recovered by check level 4 (works often, but not necessarily always, but never with check level 3). If it does not work, then you have to rebuild the chainstate entirely.
But for any other index (such as the "txindex" or "coinstats" index, there's NO check at all with recovery at startup, so the only way to recover is to entirely delete the content of that index directory and rebuild it from zero (and this will take many hours, and may fail again in the middle, due to bad blocks sent by malicious peers and that may have still not been replaced by valid blocks in the main chain).
Apparently these bad blocks seem to come from unapproved forks (possibly implementing SegWit with too large block sizes?), which are not correctly detected and cause the indexer to fail or run into some infinite loops, or some bad signatures using unsupported/snon-standard bytecodes, taking extremely long time to validate or just discard rapidly as invalid.
Such events with bad blocks coming from malicious peers tend to be frequent now. Unfortunately it's not easy to track which nodes caused that bug as they may not even be connected since long: they have sent their garbage and have disconnected themselves as soon as done, just to crash specific versions of Bitcoin Core not detecting them.
(Note: this is once again occuring with the current unmodified release v23.0 from your official site; it affects both Linux and Windows versions).