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

cln-plugin: do not panic when the log writer task is gone

Public commit record

What the developer wrote

Authored by cdecker

83/100 · Strong
cln-plugin: do not panic when the log writer task is gone

LoggingLayer::on_event forwarded events to the log writer task with
sender.send(...).unwrap(). Once that task is gone -- the runtime is
shutting down, or the task was dropped or panicked -- the receiver
has been dropped, send returns Err(SendError(entry)) and the unwrap
panics in whichever code emitted the log event. This usually showed
up during node shutdown, after "Lost connection to the RPC socket."

Take the entry back out of the SendError and write it to stderr
instead: logging must never panic, and we must not drop the entry
either. stderr and not stdout, since stdout is the JSON-RPC channel
to lightningd.

Add a unit test that drives the LoggingLayer with a dropped receiver
via a local subscriber; it panics without the fallback.

Changelog-Fixed: cln-plugin: a plugin no longer panics when it logs after its log writer task has exited (e.g., during shutdown); the message is written to stderr instead.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification
The short version

What changed, and why it matters

This commit fixes a bug in Core Lightning's Rust plugin library where a plugin could crash with a panic if it tried to log a message after the internal log-writing task had already stopped, such as during shutdown. The fix makes the plugin print the message to stderr instead of crashing. It is a reliability fix rather than an active remote exploit.

Recommended action

Treat as a routine bug-fix patch improving plugin shutdown robustness. No urgent security response is indicated, but downstream plugin authors should update to avoid shutdown-time panics.

Security signals we found

01

panic on send failure replaced with stderr fallback

02

log message no longer silently dropped on writer task exit

03

unit test added for dropped-receiver scenario

Risk score

Why this scored 43/100

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