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

fix(iroh-net): Ensure netcheck finishes once it has results #2027

Merged
merged 1 commit into from
Feb 16, 2024

Conversation

flub
Copy link
Contributor

@flub flub commented Feb 15, 2024

Description

Once netcheck has managed to establish an external IP address there is
no need to further wait on the portmapper. The results are already
useful. If later the portmapper manages to get something done the
magicsock will react to that and make use of it.

Notes & open questions

Fixes #2021

Change checklist

  • Self-review.
  • Documentation updates if relevant.
  • Tests if relevant.

Once netcheck has managed to establish an external IP address there is
no need to further wait on the portmapper.  The results are already
useful.  If later the portmapper manages to get something done the
magicsock will react to that and make use of it.
Copy link
Contributor

@dignifiedquire dignifiedquire left a comment

Choose a reason for hiding this comment

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

code looks good, what impact have you seen in testing?

/// This is set to true in tests to avoid probing the local LAN's router etc.
///
/// TODO: currently this only skips the portmapper, but still does STUN, HTTP and ICMP
/// probes. Furthermore none of our tests actually use this feature.
Copy link
Contributor

Choose a reason for hiding this comment

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

honestly, just delete it, we can bring it back if we ever need to

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, fair enough. i'll do that in a separate PR though.

@flub
Copy link
Contributor Author

flub commented Feb 15, 2024

Pinging @divagant-martian to check my understanding of the portmapper is correct.

I think what happens is that on the very first netcheck the portmapper has not yet run to completion and that slows down the first netcheck, often only to not get a portmapper result anyway. Later on there are cached reports that are returned. As all this is reporting is a bunch of bools in an option I think it's fine to not wait for this the first time.

@flub
Copy link
Contributor Author

flub commented Feb 15, 2024

code looks good, what impact have you seen in testing?

Testing it is pretty hard, things still seem to work though. And I'm pretty sure this is the path that failed when looking at the logs where the problem was reported.

@flub
Copy link
Contributor Author

flub commented Feb 16, 2024

@divagant-martian I'm going to interpret the thumbs-up as approval. Can always revert if that was wrong.

@flub flub added this pull request to the merge queue Feb 16, 2024
Merged via the queue into main with commit c62950e Feb 16, 2024
19 checks passed
@flub flub deleted the flub/netcheck-stop-fast branch February 16, 2024 09:22
github-merge-queue bot pushed a commit that referenced this pull request Feb 19, 2024
## Description

We were incorrectly identifying globally routable IPv6 addresses as
not routable.  This make netcheck skip IPv6 addresses.

## Notes & open questions

Closes #2022 

The fix in the netcheck, test is curious, it fails on this PR fairly
consistently yet it is really a flaky test introduced in combination
with #2027.
Now that we have IPv6 resolving properly we might get an IPv6 result.
Since
this test only has a single DerpUrl it only needs one result to
complete.
This could be an IPv4 OR an IPv6 result, we don't know which one will be
faster. And if the other is slow enough then it won't be received. I
think
this behaviour is fine, we simply can't guarantee that both must have a
result
and the point of netcheck is to return something working quickly.

## Change checklist

- [x] Self-review.
- [x] Documentation updates if relevant.
- [x] Tests if relevant.
fubuloubu pushed a commit to ApeWorX/iroh that referenced this pull request Feb 21, 2024
…ter#2027)

## Description

Once netcheck has managed to establish an external IP address there is
no need to further wait on the portmapper.  The results are already
useful.  If later the portmapper manages to get something done the
magicsock will react to that and make use of it.

## Notes & open questions

Fixes n0-computer#2021

## Change checklist

- [x] Self-review.
- [x] Documentation updates if relevant.
- [x] Tests if relevant.
fubuloubu pushed a commit to ApeWorX/iroh that referenced this pull request Feb 21, 2024
…computer#2030)

## Description

We were incorrectly identifying globally routable IPv6 addresses as
not routable.  This make netcheck skip IPv6 addresses.

## Notes & open questions

Closes n0-computer#2022 

The fix in the netcheck, test is curious, it fails on this PR fairly
consistently yet it is really a flaky test introduced in combination
with n0-computer#2027.
Now that we have IPv6 resolving properly we might get an IPv6 result.
Since
this test only has a single DerpUrl it only needs one result to
complete.
This could be an IPv4 OR an IPv6 result, we don't know which one will be
faster. And if the other is slow enough then it won't be received. I
think
this behaviour is fine, we simply can't guarantee that both must have a
result
and the point of netcheck is to return something working quickly.

## Change checklist

- [x] Self-review.
- [x] Documentation updates if relevant.
- [x] Tests if relevant.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

netcheck report does not finish early enough
2 participants