AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Informational 17 Bitcoin

Merge bitcoin/bitcoin#36148: test: Avoid unsafe memory race in index_reorg_crash shutdown

Public commit record

What the developer wrote

Authored by merge-script

100/100 · Strong
Merge bitcoin/bitcoin#36148: test: Avoid unsafe memory race in index_reorg_crash shutdown

fab80e82c1087126477e07eda5f6e3a1f25ceb99 test: Avoid unsafe memory race in baseindex_no_commit_ahead_of_flush (MarcoFalke)
fa0f14ef5e76424ed7770936f7d053f27336a601 test: Avoid unsafe memory race in index_reorg_crash shutdown (MarcoFalke)
faf9c8e8a12cff5ef4f277d8c3f1035776e57c14 test: Clarify index.GetSummary().synced state in index_reorg_crash (MarcoFalke)

Pull request description:

Currently, the `index_reorg_crash` test may rarely crash due to UB in sanitizers like TSan or ASan. This is perfectly fine, because it is just a rare test-only issue.

However, fix it nonetheless by adding a missing drain of the unused in-flight events. Also, add a small check about the synced state while touching this test.

ACKs for top commit:
arejula27:
ACK fab80e82c1
furszy:
ACK fab80e82c1087126477e07eda5f6e3a1f25ceb99

Tree-SHA512: 4423e420421aa37d8b59e053f44c455fafb676102866bdf23988cf72f3d3f265b996bd953583ea8208f1534defb0e16b13ef08644be97e61959dc777a2918e5a
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This is a fix for a flaky test in Bitcoin Core, not a fix for the Bitcoin network or wallet software itself. The test sometimes crashed under memory-safety checkers because it shut down an index while background validation events were still in flight. The patch drains those pending events before shutdown, similar to what the real shutdown code does. It does not affect live node behavior or user funds.

Recommended action

No production action needed. Developers running CI or the affected tests should verify the tests no longer flake under TSan/ASan. The fix can be treated as a routine test robustness improvement.

Security signals we found

01

Race condition in test teardown

02

Use of TSan/ASan-detected undefined behavior in test code

03

Missing synchronization with validation interface queue before object destruction

04

Test-only fix, no production code changed

Risk score

Why this scored 17/100

Our methodology →
Potential impact 2/30
Exploitability 0/25
Stealth signal 1/15
Affected reach 1/15
Confidence 9/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.