Skip to content

Commit 99b3af7

Browse files
committed
Merge bitcoin/bitcoin#28044: test: indexes, fix on error infinite loop
89ba890 test: indexes, fix on error infinite loop (furszy) Pull request description: Coming from bitcoin/bitcoin#28036 (comment), I thought that we were going to fix it there but seems that got merged without it for some reason. As index sync failures trigger a shutdown request without notifying `BaseIndex::BlockUntilSyncedToCurrentChain` in any way, we also need to check whether a shutdown was requested or not inside 'IndexWaitSynced'. Otherwise, any error inside the index sync process will hang the test forever. ACKs for top commit: MarcoFalke: lgtm ACK 89ba890 jamesob: ACK 89ba890 ryanofsky: Code review ACK 89ba890. Just comment update since last review Tree-SHA512: 1f6daf34e51d3fbc802799bfa4ac0ef0d8f774db5f9e2f5d35df18a77679778475c94efc3da1fb723ebaf3583e4075e4a5cbe4a5104ad0c50e2b32076e247b29
2 parents e253568 + 89ba890 commit 99b3af7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/test/util/index.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,18 @@
55
#include <test/util/index.h>
66

77
#include <index/base.h>
8+
#include <shutdown.h>
9+
#include <util/check.h>
810
#include <util/time.h>
911

1012
void IndexWaitSynced(const BaseIndex& index)
1113
{
1214
while (!index.BlockUntilSyncedToCurrentChain()) {
15+
// Assert shutdown was not requested to abort the test, instead of looping forever, in case
16+
// there was an unexpected error in the index that caused it to stop syncing and request a shutdown.
17+
Assert(!ShutdownRequested());
18+
1319
UninterruptibleSleep(100ms);
1420
}
21+
assert(index.GetSummary().synced);
1522
}

0 commit comments

Comments
 (0)