1 major finding · 3 minor findings · 1 suggestion
Earlier concerns neither republished nor resolved: 2 suggestions. See the Run archive for their assessments.
Findings
[major] · Race tests deadlock before sending filter requests
Each test blocks the scheduler, then waits for the validation queue to drain; test_bitcoin hangs before reaching the filter requests.
Location: src/test/cfilter_race_tests.cpp:109 (head).
Details and suggested fix
All three tests call blocker->Arm() and then CreateAndProcessBlock({}, coinbase_script) with the default sync=true. That call invokes SyncWithValidationInterfaceQueue(), which waits for a callback queued behind BlockConnected. The scheduler is blocked in PreFilterBlocker::BlockConnected waiting for Release(), which the test thread calls only after CreateAndProcessBlock returns. The test therefore never reaches WaitForEntry() or the getcfilters/getcfheaders requests, and the unit-test run hangs until a timeout kills it. Pass /*sync=*/false at lines 109, 213, and 316, and keep the explicit SyncWithValidationInterfaceQueue() after Release().
[minor] · Snapshot background sync can park filter requests until the peer times out
With a loaded assumeutxo snapshot and -peerblockfilters, requests for stop blocks ahead of the filter index can stall that peer's connection until a ping timeout disconnects it.
Location: src/net_processing.cpp:3599 (head).
Details and suggested fix
CFilterIndexMayBeRacing() treats the index as racing whenever its best block differs from the active tip and the requested stop block is not an ancestor of the index's best block. It does not limit how far ahead the stop block may be. With an assumeutxo snapshot, the filter index follows ValidatedChainstate() and ignores BlockConnected events where role.validated == false, so it follows the background chainstate. Meanwhile, IsInitialBlockDownload() latches false once the snapshot chain reaches a recent tip. Until background validation finishes and the indexes restart, requests whose stop hash is above the background tip, such as the active tip, are parked. While a request is parked, ProcessMessages() reads nothing else from that peer, including its pongs. SendMessages() then disconnects the peer after the 20-minute ping timeout, and reconnecting clients encounter the same behavior. On the base revision, the request went unanswered but the connection remained usable. A disconnect-only invalidateblock can have a similar effect: BaseIndex has no BlockDisconnected handler, so its best block can remain on a descendant of the active tip and requests for valid stale-branch blocks are parked until another block connects. The WaitForRacingWrite/CF_MAX_BLOCKS_AHEAD_RACE_WAIT = 2 bound described in the PR is not in the tree. Compare against the index's own chainstate with an ancestry check, as BlockUntilSyncedToCurrentChain() does, and park only when the stop block is on the active chain and within a small height of the index's best block.
[minor] · Deferred filter responses bypass the ProcessMessages() exception handler
A local filter-index read failure while serving a parked request can terminate the node instead of being caught and logged.
Location: src/net_processing.cpp:5621 (head).
Details and suggested fix
AttemptPendingRequest() runs before the try/catch block that ProcessMessages() uses to contain handler exceptions. It serves the parked request through ServeGetCFilters, ServeGetCFHeaders, or ServeGetCFCheckPt, which read the filter index through LookUpOne() or LookupRange() and CDBWrapper::Read(). If LevelDB reports an error other than NotFound, Read() throws dbwrapper_error. CConnman::ThreadMessageHandler does not catch it, and util::TraceThread logs and rethrows it, so the process terminates. On the base revision, the same serving code ran inside ProcessMessage, where the exception was caught and logged. This requires a local index read failure during the deferred retry; a remote peer cannot trigger it against a healthy index. Run the deferred serve under the same exception handling, for example through a helper shared with the ProcessMessage path.
[minor] · Filter requests are parked before existing request checks run
While the index lags, requests the base code rejects immediately are parked instead, and the difference in handling known and unknown stop hashes can reveal which headers the node knows.
Location: src/net_processing.cpp:3673 (head).
Details and suggested fix
The three ProcessGetCF* handlers call CFilterIndexMayBeRacing() before ServeGetCF*(). This delays the checks in PrepareBlockFilterRequest() until a parked request is retried, including the NODE_COMPACT_FILTERS service check, BlockRequestAllowed(), the start-height check, and the range limit. CFilterIndexMayBeRacing() itself only requires an enabled basic filter index and a known stop hash. While the index lags, requests that the base code disconnects immediately are parked instead. These include requests for headers-only, invalid, or old stale blocks; requests with a bad range; and requests to a node running -blockfilterindex without -peerblockfilters. An unknown stop hash still reaches PrepareBlockFilterRequest() and is disconnected at once. A peer can use this difference to test whether the node knows a header that BlockRequestAllowed() is intended to hide. In normal operation, the window is the callback lag after each block; during assumeutxo background validation, it can last hours. Run PrepareBlockFilterRequest() first, and park only requests that pass those checks but then miss the index lookup.
Optional improvements
[suggestion] · Test failure paths can leave the scheduler blocked or a global callback dangling
A failing assertion can hang fixture teardown or leave a callback referring to destroyed locals, obscuring the original test failure.
Location: src/test/cfilter_race_tests.cpp:250 (head).
Details and suggested fix
Once the CreateAndProcessBlock deadlock is fixed, a BOOST_REQUIRE between WaitForEntry() and Release() (for example, at lines 117–122 or in the ReceiveMsgFrom checks) exits the test while PreFilterBlocker is still waiting on m_release_fut. ValidationSignals holds its own shared_ptr, so destroying the local blocker does not unblock it. ChainTestingSetup then calls m_node.scheduler->stop(), which joins the blocked scheduler thread, so teardown hangs instead of reporting the failure. Separately, a failing BOOST_REQUIRE_EQUAL at line 282 skips restoration of the global CaptureMessage, leaving it pointing to a lambda that captures the destroyed sent_types by reference. The other two tests restore it only on the success path as well. Install a scope guard after registering the blocker that calls Release() and unregisters it, and another that restores CaptureMessage before its captured locals go out of scope.
Earlier concerns
Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.
- [suggestion]: The test comment and PR description do not match the implemented mechanism (earlier report)
- [suggestion]: The deferred cfheaders test does not verify the response contents (earlier report)