Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: catch panics in identify #1376

Closed
wants to merge 2 commits into from
Closed

feat: catch panics in identify #1376

wants to merge 2 commits into from

Conversation

Stebalien
Copy link
Member

@Stebalien Stebalien commented Apr 9, 2022

We haven't seen any panics in identify, but I'm going through and adding panic handlers to libp2p handlers because the benefits often outweigh the risk:

  • Risk: We might continue with corrupted state. In this case, that means continuing with a corrupted peerstore, which likely doesn't have a huge impact on anything. If something is really wrong, we'll crash somewhere else.
  • Benefit: if we panic when processing an identify response, we won't crash the entire node.

Part of #1389

That way, we'll unlock even on panic. We're consuming the remote "peer
record" so we might as well be safe.
if err := s.Scope().SetService(ServiceName); err != nil {
log.Warnf("error attaching stream to identify service: %s", err)
s.Reset()
Copy link
Contributor

Choose a reason for hiding this comment

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

You're creating a new err here that shadows the err return value, don't you?

Copy link
Member Author

Choose a reason for hiding this comment

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

err will be shadowed inside this condition, but the err in the "defer" will still refer to the named return value.

@Stebalien Stebalien mentioned this pull request Apr 11, 2022
@BigLep BigLep added this to the Best Effort Track milestone Sep 16, 2022
@BigLep BigLep added the P3 Low: Not priority right now label Sep 16, 2022
@BigLep BigLep linked an issue Sep 16, 2022 that may be closed by this pull request
@BigLep
Copy link
Contributor

BigLep commented Sep 16, 2022

2022-09-16 conversation: we need to evaluate if this is the right place to do this or determine if our panic handlers in serialization functions are sufficient.

@marten-seemann
Copy link
Contributor

Closing since we've done a major refactor of Identify.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 Low: Not priority right now
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Catching panics
3 participants