Review report

core: PR #35354

2 minor findings · 2 suggestions

Earlier concerns neither republished nor resolved: 2 suggestions. See the Run archive for their assessments.

Findings

Link

[minor] · Persistent index-tip mismatches park the peer's incoming messages

With an already-synced index during assumeutxo background validation, a recent filter request can pause the peer's later messages long enough to cause a ping-timeout disconnect.

Location: src/net_processing.cpp:3599 (head).

Details and suggested fix

CFilterIndexMayBeRacing() treats unequal index and active tips as pending work for every known stop block outside the index tip's ancestry, without a distance bound. During assumeutxo background validation, the index follows ValidatedChainstate() and ignores unvalidated snapshot callbacks, while IBD can already be false for the current snapshot chain. A recent snapshot-chain request can therefore remain parked until background validation completes and the indexes restart. A disconnect-only invalidateblock can also leave the index ahead indefinitely; a request for a previously indexed, still-valid non-ancestor on an earlier stale branch is parked even though its hash-keyed filter is available. While parked, the peer's pongs and later requests are not polled. If the mismatch persists, a client not serving us blocks can reach the 20-minute ping timeout; base left only the missing filter request unanswered. Use an ancestor-based caught-up check against the index's own chainstate, and restrict deferral to nearby targets on that chain while preserving equal-height sibling reorgs. No production report of a BIP157 client encountering this during background validation was found, so production occurrence remains unconfirmed.


Link

[minor] · Deferred filter responses bypass the handler exception boundary

A local filter-index database read error during deferred serving can terminate the node instead of being caught and logged as it is for immediate requests.

Location: src/net_processing.cpp:5621 (head).

Details and suggested fix

ProcessMessages() calls AttemptPendingRequest() before the try block containing ProcessMessage(). Deferred serving can throw: for example, ServeGetCFHeaders() reads the previous filter header, and a non-checkpoint lookup reaches LookUpOne() and CDBWrapper::Read(), which throws dbwrapper_error on a database error. ThreadMessageHandler() has no intervening catch, and TraceThread() logs and rethrows, so the exception escapes the thread entry point and terminates the process. This requires a local index read failure, such as an I/O error or database corruption. Run deferred serving under the same exception handling as immediate serving.


Optional improvements

Link

[suggestion] · Fatal assertions can leave the race tests hung in teardown

A fatal assertion before blocker release can hang fixture teardown, while a failure before capture-hook restoration can leave the global hook referencing destroyed locals.

Location: src/test/cfilter_race_tests.cpp:110 (head).

Details and suggested fix

Each case runs fatal BOOST_REQUIRE checks after WaitForEntry() and before Release(). The validation registry retains the blocker, so unwinding its local shared_ptr does not end the callback's wait. Fixture teardown then calls scheduler->stop() and joins the blocked thread. The second test also restores CaptureMessage only after BOOST_REQUIRE_EQUAL(sent_types.size(), 2U), so that failure leaves the global hook capturing a destroyed vector. Install scope guards to release and unregister the blocker and restore the capture hook on every exit path. Keep the explicit normal-path Release() at its current point so the race assertions remain deterministic.


Link

[suggestion] · Race tests omit checkpoint and sibling-reorg deferral

The new suite tests only supported requests on one-block extensions, leaving checkpoint retries, invalid-request handling during lag, sibling reorgs, and persistent mismatches unconstrained.

Location: src/test/cfilter_race_tests.cpp:79 (head).

Details and suggested fix

The three cases exercise GETCFILTERS, response ordering, and GETCFHEADERS with one extending block. Add a parked GETCFCHECKPT case whose stop block is at a CFCHECKPT_INTERVAL height, so the response must include the header still being written rather than merely an empty checkpoint vector. Also exercise a same-height sibling reorg while PreFilterBlocker holds the callback, invalid or unsupported requests that should disconnect immediately during that window, and a persistent mismatch where an available stale-branch filter must not hold the peer. These transitions are not covered by the existing extension assertions or settled-index reorg tests. The introductory comment also refers to “racing-check tests above”, although this is the first test in the file; remove that stale reference.


Coverage details

Earlier concerns

Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.