Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Change checkpoint reorg in update checkpoint #916
Removing popping blocks in update_checkpoint which is often called by the networking thread when receiving enough votes to make a new checkpoint sometimes causing the daemon to lock up.
Now, if we receive a checkpoint that is conflicting with our blockchain, we remain on the alt-chain until we receive an additional block on the correct chain. Upon receiving the new block, we re-evaluate each block in the alt chain and the number of checkpoints that match for either chain, and only then do we switch to the alt chain (using the main block processing thread, thereby avoiding locking problems in update_checkpoint).
This will bump the patch to version 3.
jagerman left a comment •
Looks good for now.
I think this deadlock is coming down to Monero's locking being not well implemented: everything just takes out an exclusive lock, but there are multiple locks that require a specific order; and the locks are all recursive so that the code can be sloppy just take out multiple overlapping locks. But if locks get out of order (because of locks taken out somewhere up or down the call stack) the result is a deadlock, and locks are taken out in enough different places that it's almost impossible to know whether the code is deadlock free.
That said, as much as I want to overhaul the locking, it isn't a change for 5.x.