You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
wallet_reindex.py --descriptors failed all three attempts of linux64-test / Test source on a runner with very slow disk I/O (job):
File "test/functional/wallet_reindex.py", line 75, in birthtime_test
with node.assert_debug_log(expected_msgs=["loadblk thread exit"]):
AssertionError: [node 0] Expected messages "['loadblk thread exit']" does not partially match log
assert_debug_log starts its deadline (2 s × timeout factor, so 8 s in CI) when the with block is entered. The block then contains a full restart_node, so the stop, the restart and the whole reindex all run inside those 8 s. In the failing run the stop alone took about 30 s, loading the block index took about 4 s and reconnecting 160 blocks took about 17 s. Nothing was stuck. By the time restart_node returned, the deadline had long expired, so assert_debug_log read the log only once.
restart_node returns as soon as getmempoolinfo reports loaded. In Dash that flag is set partway through the loadblk thread: after it the thread still sends tip notifications, writes the evodb repair marker with a forced chainstate flush, and fills the masternode coin cache before loadblk thread exit is logged. In the failing log the node was inside that final flush when the single read happened. So the test passes only when the entire stop/restart/reindex fits in the deadline or the remaining work happens to finish before the read.
Bitcoin Core hit the same race with its initload thread and fixed it in bitcoin#34857 by removing the wait. restart_node already waits for the import to finish, and the wallet RPCs that follow call BlockUntilSyncedToCurrentChain(), so the extra syncwithvalidationinterfacequeue() can go too.
What was done?
Backport of bitcoin#34857 (test: Remove confusing assert_debug_log in wallet_reindex.py).
Dash adaptations:
The removed wait names Dash's loadblk thread instead of initload. The surrounding context differs because Dash still runs this test with --legacy-wallet.
-reindex=1 is kept on the restart. Upstream's change also drops it, which leaves the test restarting without reindexing even though it still logs "Reindex ...". Keeping it preserves what the test is named for. wallet, test: remove unnecessary node restart from wallet_reindex bitcoin/bitcoin#34879 (open upstream) proposes removing this restart entirely.
How Has This Been Tested?
Ran the test directly in a loop on a heavily loaded Linux x86_64 host (RelWithDebInfo build of this branch), 10 at a time, datadirs on disk:
--timeout-factor=1
--timeout-factor=4
develop
14 of 40 failed with the CI assertion
0 of 40 failed
this PR
0 of 80 failed
0 of 40 failed
Both 40-run batches on this branch used upstream's exact pick (no -reindex); the 80 runs used the final version, which keeps it. A --nocleanup run confirms the restart reindexes (Reindexing block file in the node log). test_runner.py with 8 × wallet_reindex.py --descriptors and 8 × wallet_reindex.py --legacy-wallet passes. test/lint/lint-python.py reports no new findings (its only output is three mypy errors that develop shows too).
feature_reindex.py (kill_after_reindex) uses the same assert_debug_log around start_node, but there waiting for the thread exit is the point, and its 10 s × timeout-factor budget covers only the start and reindex, not a stop. It has not been seen failing, so it is left unchanged.
Breaking Changes
None. Test-only.
Checklist:
I have performed a self-review of my own code
I have made corresponding changes to the documentation
…t_reindex.py
fa30951 test: Remove confusing assert_debug_log in wallet_reindex.py (MarcoFalke)
Pull request description:
The `wallet_reindex.py` test has many issues:
* It uses a `assert_debug_log` to ensure the reindex happened via `initload thread exit`. However, no other test uses this pattern, because `restart_node` already achieves the same internally (via `getmempoolinfo.loaded`).
* The `assert_debug_log` may intermittently fail, because the `initload thread exit` log may happen at any time after the inner thread function (lambda) is fully done.
* The test uses an `node.syncwithvalidationinterfacequeue()` without any explanation. No other test uses this pattern, because all wallet RPCs, in particular the next one (`gettransaction`) call it internally (via `BlockUntilSyncedToCurrentChain`).
Fix all issues by removing all confusing, useless, and brittle calls.
Example failure: https://github.com/bitcoin/bitcoin/actions/runs/22671604602/job/65716917459?pr=34419#step:11:22339
```
...
node0 2026-03-04T13:55:23.784715Z (mocktime: 2026-03-04T22:15:17Z) [scheduler] [validationinterface.cpp:185] [operator()] [validation] UpdatedBlockTip: new block hash=24b5cc4c1352bc8841ecbe67a43827acd1adc609bd26b2691e80e89b97eff135 fork block hash=24a4dc8be9c157ac31913397d8bb1653900e12b55539c234039559fdeb6dd2fb (in IBD=true)
node0 2026-03-04T13:55:23.784851Z (mocktime: 2026-03-04T22:15:17Z) [initload] [util/thread.cpp:22] [TraceThread] initload thread exit
test 2026-03-04T13:55:23.813824Z TestFramework (ERROR): Unexpected exception:
Traceback (most recent call last):
File "/home/admin/actions-runner/_work/_temp/test/functional/test_framework/test_framework.py", line 142, in main
self.run_test()
File "/home/admin/actions-runner/_work/_temp/build/test/functional/wallet_reindex.py", line 90, in run_test
self.birthtime_test(node, miner_wallet)
File "/home/admin/actions-runner/_work/_temp/build/test/functional/wallet_reindex.py", line 64, in birthtime_test
with node.assert_debug_log(expected_msgs=["initload thread exit"]):
File "/usr/lib/python3.12/contextlib.py", line 144, in __exit__
next(self.gen)
File "/home/admin/actions-runner/_work/_temp/test/functional/test_framework/test_node.py", line 607, in assert_debug_log
self._raise_assertion_error(f'Expected message(s) {remaining_expected!s} '
File "/home/admin/actions-runner/_work/_temp/test/functional/test_framework/test_node.py", line 241, in _raise_assertion_error
raise AssertionError(self._node_msg(msg))
AssertionError: [node 0] Expected message(s) ['initload thread exit'] not found in log:
```
Diff to reproduce failure:
```diff
diff --git a/src/util/thread.cpp b/src/util/thread.cpp
index 0fde73c..de4c05e752 100644
--- a/src/util/thread.cpp
+++ b/src/util/thread.cpp
@@ -8,2 +8,3 @@
#include <util/log.h>
+#include <util/time.h>
#include <util/threadnames.h>
@@ -21,2 +22,3 @@ void util::TraceThread(std::string_view thread_name, std::function<void()> threa
thread_func();
+ UninterruptibleSleep(999ms);
LogInfo("%s thread exit", thread_name);
diff --git a/test/functional/wallet_reindex.py b/test/functional/wallet_reindex.py
index 71ab69e..649df4301a 100755
--- a/test/functional/wallet_reindex.py
+++ b/test/functional/wallet_reindex.py
@@ -62,2 +62,3 @@ class WalletReindexTest(BitcoinTestFramework):
+ import time; time.sleep(1) # Wait for previous initload thread to exit fully
# Reindex and wait for it to finish
```
Before on master: Test fails
After on this pull: Test passes
ACKs for top commit:
rkrux:
ACK fa30951 if this PR needs to be backported.
Tree-SHA512: 1e6599511e09b5b9ac4aed96a6b1b8239d5dc63b164fc0c163b6f9f5bc72c1c61f72ad8256a01875208d825af46d057c4d9de61758002f256388ddb324006bb5
Dash adaptations: keep `-reindex=1` on the restart. Upstream dropped it in
this change, which leaves the test restarting without reindexing; the
removed wait names Dash's `loadblk` thread instead of `initload`.
(cherry picked from commit 16613c9)
No actionable comments were generated in the recent review.
Walkthrough
The wallet reindex test now logs the reindex step instead of asserting a debug-log message and synchronizing the validation-interface queue. It still restarts the node with -reindex=1 and the current mock time. The later transaction-confirmation and wallet-birthtime checks remain.
dashpay/dash#7946: This PR also changes the loadblk log-wait behavior in wallet_reindex.py.
Suggested reviewers: dcg-claude
Merge Risk: Minimal · up to 1651a
This test-only change makes the wallet reindex functional test less likely to fail under slow I/O. It has no production impact and is low risk to merge.
Pre-merge checks: 3 · 1
Failed checks: 1 inconclusive
Check name
Status
Explanation
Resolution
Title check
The title "backport: bitcoin#34857" names the upstream change being backported, but it does not describe the change itself. It gives no hint that the change removes an assert_debug_log wait in wallet_…
Rewrite the title to name the primary change. For example: "test: remove brittle assert_debug_log wait in wallet_reindex.py". This keeps the upstream reference (bitcoin#34857) in the description or the title suffix.
Passed checks: 3 passed
Check name
Status
Explanation
Description check
The description explains the CI failure in wallet_reindex.py, where assert_debug_log's deadline covers a full restart_node. It states the removal of the loadblk-thread wait and the syncwithvalidationi…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Description check
Explanation
The description explains the CI failure in wallet_reindex.py, where assert_debug_log's deadline covers a full restart_node. It states the removal of the loadblk-thread wait and the syncwithvalidationinterfacequeue() call, the retained -reindex=1 flag, and the test results. It is directly related to the changeset.
Full details: Title check
Explanation
The title "backport: bitcoin#34857" names the upstream change being backported, but it does not describe the change itself. It gives no hint that the change removes an assert_debug_log wait in wallet_reindex.py. A reader scanning history cannot tell the primary change from the title alone. The title is vague and generic, so the check is inconclusive.
Resolution
Rewrite the title to name the primary change. For example: "test: remove brittle assert_debug_log wait in wallet_reindex.py". This keeps the upstream reference (bitcoin#34857) in the description or the title suffix.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 7fbb2806-3637-4d2d-ae47-336392ae21bc
Commits
Reviewing files that changed from the base of the PR and between b0d17d4 and 1651ac0.
Files selected for processing: 1
test/functional/wallet_reindex.py
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Final validation — Phase 1 + Phase 2
The backport is a focused test-only change that removes the racy debug-log wait and redundant validation-interface synchronization while retaining Dash’s -reindex=1 coverage. The changed test logic is supported by restart_node’s import-completion wait and the following wallet RPC synchronization; build, lint, cppcheck, and formatting checks pass, with the functional test job still in progress and no reported failure.
Triage: low by gpt-6.2-sol (effort low) — The diff removes two synchronization checks from one functional test while preserving the reindex restart, with no production code changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue being fixed or feature implemented
wallet_reindex.py --descriptorsfailed all three attempts oflinux64-test / Test sourceon a runner with very slow disk I/O (job):assert_debug_logstarts its deadline (2 s × timeout factor, so 8 s in CI) when thewithblock is entered. The block then contains a fullrestart_node, so the stop, the restart and the whole reindex all run inside those 8 s. In the failing run the stop alone took about 30 s, loading the block index took about 4 s and reconnecting 160 blocks took about 17 s. Nothing was stuck. By the timerestart_nodereturned, the deadline had long expired, soassert_debug_logread the log only once.restart_nodereturns as soon asgetmempoolinforeportsloaded. In Dash that flag is set partway through theloadblkthread: after it the thread still sends tip notifications, writes the evodb repair marker with a forced chainstate flush, and fills the masternode coin cache beforeloadblk thread exitis logged. In the failing log the node was inside that final flush when the single read happened. So the test passes only when the entire stop/restart/reindex fits in the deadline or the remaining work happens to finish before the read.Bitcoin Core hit the same race with its
initloadthread and fixed it in bitcoin#34857 by removing the wait.restart_nodealready waits for the import to finish, and the wallet RPCs that follow callBlockUntilSyncedToCurrentChain(), so the extrasyncwithvalidationinterfacequeue()can go too.What was done?
Backport of bitcoin#34857 (test: Remove confusing assert_debug_log in wallet_reindex.py).
Dash adaptations:
loadblkthread instead ofinitload. The surrounding context differs because Dash still runs this test with--legacy-wallet.-reindex=1is kept on the restart. Upstream's change also drops it, which leaves the test restarting without reindexing even though it still logs "Reindex ...". Keeping it preserves what the test is named for. wallet, test: remove unnecessary node restart from wallet_reindex bitcoin/bitcoin#34879 (open upstream) proposes removing this restart entirely.How Has This Been Tested?
Ran the test directly in a loop on a heavily loaded Linux x86_64 host (RelWithDebInfo build of this branch), 10 at a time, datadirs on disk:
--timeout-factor=1--timeout-factor=4Both 40-run batches on this branch used upstream's exact pick (no
-reindex); the 80 runs used the final version, which keeps it. A--nocleanuprun confirms the restart reindexes (Reindexing block filein the node log).test_runner.pywith 8 ×wallet_reindex.py --descriptorsand 8 ×wallet_reindex.py --legacy-walletpasses.test/lint/lint-python.pyreports no new findings (its only output is three mypy errors that develop shows too).feature_reindex.py(kill_after_reindex) uses the sameassert_debug_logaroundstart_node, but there waiting for the thread exit is the point, and its 10 s × timeout-factor budget covers only the start and reindex, not a stop. It has not been seen failing, so it is left unchanged.Breaking Changes
None. Test-only.
Checklist:
🤖 Generated with Claude Code