-
Notifications
You must be signed in to change notification settings - Fork 976
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(kad): correctly handle NoKnownPeers
error when bootstrap
#5349
fix(kad): correctly handle NoKnownPeers
error when bootstrap
#5349
Conversation
This looks a bit hacky, wouldn't it be better to modify the bootstrap |
I'm not sure to understand what you mean. Even if I would update the I agree that it would feel better to have a passive way to learn that a bootstrap did start or finish but I don't see how to implement that in a reasonably simple manner. The reason we need to know if a bootstrap as started or finished is because we don't want to cascade bootstrap requests. When a bootstrap is triggered (no matter if it was automatic, periodic or manual), we reset the automatic and periodic timer to their initial value. |
67e9aca
to
ec9898f
Compare
f2d3e48
to
f0ee433
Compare
f0ee433
to
94c11d9
Compare
Not checking whether the routing table is empty would take us back to before this commit. IMO it is good that this check was introduced, allowing the bootstrap to fail fast. If the check isn't performed, a new query for self is created, and the first time |
I'm not sure about that. If a check is needed when the routing table is empty, why is it not done for the other queries like |
I agree that the empty routing table check should be consistent with other queries, and it would even be better if the check was unified (e.g when creating the query?). But this can be left for a follow up PR. |
This pull request has merge conflicts. Could you please resolve them @stormshield-frb? 🙏 |
345424b
to
2922bde
Compare
2922bde
to
f1dfb2b
Compare
@stormshield-frb what do you think of b548fc7? IMO it is a slightly cleaner, because if the routing table is empty, we simply reset the timers, and we don't need to increase and then decrease the count of bootstrap requests, and we don't need to wake the If you disagree, we can revert to the last commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks François, and Gui for the review!
After testing `master`, we encountered a bug due to libp2p#4838 when doing automatic or periodic bootstrap if the node has no known peers. Since it failed immediately, I though there was no need to call the `bootstrap_status.on_started` method. But not doing so never resets the periodic timer inside `bootstrap_status` resulting in getting stuck to try to bootstrap every time `poll` is called on `kad::Behaviour`. Pull-Request: libp2p#5349.
Description
After testing
master
, we encountered a bug due to #4838 when doing automatic or periodic bootstrap if the node has no known peers.Since it failed immediately, I though there was no need to call the
bootstrap_status.on_started
method. But not doing so never resets the periodic timer insidebootstrap_status
resulting in getting stuck to try to bootstrap every timepoll
is called onkad::Behaviour
.Notes & open questions
N/A
Change checklist