Skip to content

Conversation

@github-actions
Copy link

Backport of #10470


In this commit, we add a centralized panic recovery mechanism for gossip
goroutines. This increases the robustness of message processing in the
gossiper, as now we are able to keep on trucking in the face of logic
errors that may lead to panics.

We ensure that any deps are freed and we log the panic trace to help
catch bugs in the future.

IMO this is a defensive pattern we should adopt in other sub-systems that
implement the p2p facing functionality of the daemon. A lil defensive
programming can go a long way.

In this commit, we add a centralized panic recovery mechanism for gossip
goroutines. This increases the robustness of message processing in the
gossiper, as now we are able to keep on trucking in the face of logic
errors that may lead to panics.

We ensure that any deps are freed and we log the panic trace to help
catch bugs in the future.

(cherry picked from commit caf4850)
In this commit, we extend the panic recovery mechanism to cover the
serial processing path for AnnounceSignatures1 messages. Unlike other
gossip messages which are processed in parallel goroutines, announcement
signatures are processed serially in the main networkHandler loop.

A panic during this serial processing would previously crash the entire
gossiper. This change wraps the processing in an anonymous function with
a deferred panic recovery, ensuring resilience without changing the
serial processing semantics.

Since AnnounceSignatures bypass the validation barrier, we pass nil for
the jobID parameter.

(cherry picked from commit bcb65f5)
@ziggie1984 ziggie1984 force-pushed the backport-10470-to-v0.20.x-branch branch from f06fa58 to 5cf38ed Compare January 13, 2026 07:17
Copy link
Collaborator

@ziggie1984 ziggie1984 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, pending for the CI to pass

@yyforyongyu
Copy link
Member

weird that the linter failed

@ziggie1984
Copy link
Collaborator

yeah the behavior of the linter changed, fixing it.

@ziggie1984
Copy link
Collaborator

cherry picked as well the linter fix from: #10493

@ziggie1984 ziggie1984 merged commit d59e98b into v0.20.x-branch Jan 13, 2026
37 of 38 checks passed
@ziggie1984 ziggie1984 deleted the backport-10470-to-v0.20.x-branch branch January 13, 2026 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants