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

chore(node): [#1999] panic on upnp event GatewayNotFound #2003

Conversation

mickvandijke
Copy link
Contributor

@mickvandijke mickvandijke commented Jul 24, 2024

Description

Makes a node panic on the upnp event GatewayNotFound. This event only fires when the node runs with the --upnp flag and libp2p couldn't find the upnp gateway to open ports on.

Related Issue

Fixes #1999

Type of Change

Please mark the types of changes made in this pull request.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Other (please describe): Makes it easier to detect a problem with UPnP.

Checklist

Please ensure all of the following tasks have been completed:

  • I have read the contributing guidelines.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have updated the documentation accordingly.
  • I have followed the conventional commits guidelines for commit messages.
  • I have verified my commit messages with commitlint.

@mickvandijke mickvandijke requested a review from b-zee July 24, 2024 12:46
@mickvandijke mickvandijke force-pushed the 1999-node-should-panic-on-upnp-failure branch from e6b0d10 to a8d1feb Compare July 24, 2024 12:51
@@ -80,6 +80,9 @@ impl SwarmDriver {
}
event_string = "upnp_event";
info!(?upnp_event, "UPnP event");
if let libp2p::upnp::Event::GatewayNotFound = upnp_event {
panic!("UPnP is not enabled/supported on your gateway. Please rerun without the `--upnp` flag");
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be an error that we bubble up. In that case we could also later do graceful shutdowns of our swarm. sn_networking is a library crate, so we don't want consumers to get panics.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can bubble the error up, but it would be by one level and still within the sn_networking lib:

https://github.com/maidsafe/safe_network/blob/main/sn_networking/src/driver.rs#L735-L741

Handling this error gracefully would probably take some refactoring. Not sure if that is worth it. Thoughts?

@mickvandijke mickvandijke requested a review from b-zee August 2, 2024 12:14
@mickvandijke mickvandijke force-pushed the 1999-node-should-panic-on-upnp-failure branch 2 times, most recently from 7e2be6c to ad656e1 Compare August 2, 2024 14:07
@mickvandijke mickvandijke marked this pull request as ready for review August 2, 2024 14:33
@mickvandijke mickvandijke enabled auto-merge August 2, 2024 15:50
@RolandSherwin RolandSherwin force-pushed the 1999-node-should-panic-on-upnp-failure branch from ad656e1 to 816ef88 Compare August 5, 2024 12:51
@mickvandijke mickvandijke added this pull request to the merge queue Aug 5, 2024
github-merge-queue bot pushed a commit that referenced this pull request Aug 5, 2024
…upnp-failure

chore(node): [#1999] panic on upnp event `GatewayNotFound`
Merged via the queue into maidsafe:main with commit 5e61746 Aug 5, 2024
40 checks passed
@mickvandijke mickvandijke deleted the 1999-node-should-panic-on-upnp-failure branch August 5, 2024 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Node should panic on upnp failure when the --upnp flag is specified
2 participants