Closed yeastplume closed 2 years ago
Surprisingly small fix that took ages to track down - reverses the order in which header_pmmr and tx_hashset are locked during validation, which appears to fix a deadlock.
header_pmmr
tx_hashset
Why? Because block headers coming in during validation were causing a race condition with the locks in the desegmenter validation (which appears to be why the deadlock worked once in a while): https://github.com/mimblewimble/grin/blob/b08a6dd52807aa5fdc0b5a22d2a834ee46da6f41/chain/src/chain.rs#L465
Needs testing still.
For future reference, parking_lot has a deadlock detector which was very useful for tracking this down: https://amanieu.github.io/parking_lot/parking_lot/deadlock/index.html
Surprisingly small fix that took ages to track down - reverses the order in which
header_pmmr
andtx_hashset
are locked during validation, which appears to fix a deadlock.Why? Because block headers coming in during validation were causing a race condition with the locks in the desegmenter validation (which appears to be why the deadlock worked once in a while): https://github.com/mimblewimble/grin/blob/b08a6dd52807aa5fdc0b5a22d2a834ee46da6f41/chain/src/chain.rs#L465
Needs testing still.
For future reference, parking_lot has a deadlock detector which was very useful for tracking this down: https://amanieu.github.io/parking_lot/parking_lot/deadlock/index.html