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

sql: avoid trying to do parallel refreshes.

Public commit record

What the developer wrote

Authored by Rusty Russell

68/100 · Adequate
sql: avoid trying to do parallel refreshes.

Simply wait if there's one going already. This is a minor
optimization, but critical for the case where we do partial refreshes
asynchonously (rather than deleting everything and reloading). This
is currently only coinmoves and chainmoves, but the duplicated effort
is a waste everywhere.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This change fixes a bug in Core Lightning's SQL plugin where running the same table refresh twice at the same time could cause database errors (duplicate rows) or wasted work. The fix makes later refresh requests wait until the current one finishes, then continue. The commit message calls it a 'minor optimization' but the test shows it previously caused real SQL errors. It is not obviously exploitable by an external attacker, but it could affect reliability or data consistency under concurrent use.

Recommended action

Treat as a reliability/integrity fix worth including in a maintenance release. Review whether the parallel-refresh race could be triggered by untrusted RPC callers or plugin users, and consider whether command_still_pending waiters are correctly cleaned up if the waiting command is cancelled. No immediate emergency response is indicated.

Security signals we found

01

Race condition in asynchronous table refresh logic

02

SQL UNIQUE constraint failure under parallel refreshes

03

Potential duplicate/ inconsistent mirrored SQL data

04

Fix removes xfail from parallel-refresh test

05

No input validation or authentication changes

Risk score

Why this scored 43/100

Our methodology →
Potential impact 12/30
Exploitability 5/25
Stealth signal 8/15
Affected reach 7/15
Confidence 7/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.