Commit 1d24d38
committed
Merge bitcoin#30435: init: change shutdown order of load block thread and scheduler
5fd4836 init: change shutdown order of load block thread and scheduler (Martin Zumsande)
Pull request description:
This avoids situations during a reindex, in which the shutdown doesn't finish since `LimitValidationInterfaceQueue()` is called by the load block thread when the scheduler is already stopped, in which case it would block indefinitely. This can lead to intermittent failures in `feature_reindex.py` (bitcoin#30424), which I could locally reproduce with
```diff
diff --git a/src/validation.cpp b/src/validation.cpp
index 74f0e49..be1706fdaf 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -3446,6 +3446,7 @@ static void LimitValidationInterfaceQueue(ValidationSignals& signals) LOCKS_EXCL
AssertLockNotHeld(cs_main);
if (signals.CallbacksPending() > 10) {
+ std::this_thread::sleep_for(std::chrono::milliseconds(50));
signals.SyncWithValidationInterfaceQueue();
}
}
```
It has also been reported by users running `reindex-chainstate` (bitcoin#23234).
I thought for a bit about potential downsides of changing this order, but couldn't find any.
Fixes bitcoin#30424
Fixes bitcoin#23234
ACKs for top commit:
maflcko:
review ACK 5fd4836
hebasto:
re-ACK 5fd4836.
tdb3:
ACK 5fd4836
BrandonOdiwuor:
Code Review ACK 5fd4836
Tree-SHA512: 3b8894e99551c5d4392b55eaa718eee05841a7287aeef2978699e1d633d5234399fa2f5a3e71eac1508d97845906bd33e0e63e5351855139e7be04c421359b361 file changed
+3
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
| 299 | + | |
299 | 300 | | |
300 | | - | |
| 301 | + | |
| 302 | + | |
301 | 303 | | |
302 | | - | |
303 | 304 | | |
304 | 305 | | |
305 | 306 | | |
| |||
0 commit comments