pytest: fix broken message in test_even_sendcustommsg.
What changed, and why it matters
This is a tiny fix inside Core Lightning's connection handling code. It makes the daemon wake up its incoming-message listener when a peer connection is being drained and shut down. Without the wake-up, the test suite could hit a race where the daemon did not notice the peer had closed, causing a harmless but noisy 'BROKEN' log and a test failure. There is no indication this is an exploitable security bug; it is a test-flake / cleanup correctness fix.
Treat as a normal bugfix / test-stability patch. No urgent security action required. If backporting, include it with other test-flake fixes.
Security signals we found
Fixes a race/cleanup bug in peer shutdown path
No input validation, memory corruption, or cryptographic issue visible
BROKEN log message was a symptom of missed close notification, not an active exploit
Evidence from the diff
In connectd/multiplex.c, write_to_peer() now calls io_wake(&peer->peer_in) before io_sock_shutdown() when the peer is draining and has no remaining subdaemons. The missing wake meant the peer_in I/O path could stay asleep and not observe the socket close, leading to ‘Peer did not close, forcing close’ BROKEN logs and a test failure in test_even_sendcustommsg. The change ensures the read side is notified so it can clean up promptly.
Changed components
connectd/multiplex.cPeer connection drain/shutdown logicInspect captured patch +3 / −1
diff --git a/connectd/multiplex.c b/connectd/multiplex.c
index 0d5ac0dc..99137a0f 100644
--- a/connectd/multiplex.c
+++ b/connectd/multiplex.c
@@ -1082,8 +1082,10 @@ static struct io_plan *write_to_peer(struct io_conn *peer_conn,
/* Still nothing to send? */
if (!msg) {
/* Draining? We're done when subds are done. */
- if (peer->draining && tal_count(peer->subds) == 0)
+ if (peer->draining && tal_count(peer->subds) == 0) {
+ io_wake(&peer->peer_in);
return io_sock_shutdown(peer_conn);
+ }
/* If they want us to send gossip, do so now. */
if (!peer->draining)
Why this scored 18/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.