ethstats: avoid creating subscriptions on background goroutine#22587
Merged
fjl merged 4 commits intoMar 30, 2021
Conversation
holiman
reviewed
Mar 26, 2021
fjl
reviewed
Mar 26, 2021
| if headSub == nil { | ||
| log.Info("Stats daemon stopped due to nil head subscription") | ||
| return | ||
| } |
Contributor
There was a problem hiding this comment.
It's easy to avoid this error by subscribing earlier. If you create the subscriptions in New (or Start) they can never be nil.
Contributor
There was a problem hiding this comment.
If they're created in Start, then the deferred Unsubscribe will become "decoupled" from the Subscribe, which is not great either...
Contributor
There was a problem hiding this comment.
The Unsubscribe would need to move into Service.Stop then.
holiman
reviewed
Mar 30, 2021
Co-authored-by: Martin Holst Swende <martin@swende.se>
atif-konasl
pushed a commit
to frozeman/pandora-execution-engine
that referenced
this pull request
Oct 15, 2021
…eum#22587) This fixes an issue where the ethstats service could crash if geth was started and then immediately stopped due to an internal error. The cause of the crash was a nil subscription being returned by the backend, because the background goroutine creating them was scheduled after the backend had already shut down. Moving the creation of subscriptions into the Start method, which runs synchronously during startup of the node, means the returned subscriptions can never be 'nil'. Co-authored-by: Felix Lange <fjl@twurst.com> Co-authored-by: Martin Holst Swende <martin@swende.se>
9 tasks
This was referenced Sep 23, 2022
gzliudan
added a commit
to gzliudan/XDPoSChain
that referenced
this pull request
Sep 8, 2025
Merged
19 tasks
gzliudan
added a commit
to XinFinOrg/XDPoSChain
that referenced
this pull request
Sep 8, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.