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
net: Favor peers from addrman over fetching seednodes #29605
base: master
Are you sure you want to change the base?
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code CoverageFor detailed information about the code coverage, see the test coverage report. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
4755a28
to
403a919
Compare
This is currently dependent on #28016, given it redefines a local |
403a919
to
47c22cd
Compare
🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the Possibly this is due to a silent merge conflict (the changes in this pull request being Leave a comment here, if you need help tracking down a confusing failure. |
8e72300
to
e45522c
Compare
e45522c
to
8914d52
Compare
Addressed @brunoerg comment, plus slightly reworked the approach to make sure Before this, we would have queried them after the timer went off anyway |
8914d52
to
d16e17d
Compare
d16e17d
to
f809817
Compare
Rebased to fix CI due to #29610 |
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.
Concept ACK f809817.
Glad you agreed something like this was worth doing!
f809817
to
a178d28
Compare
a178d28
to
27781fe
Compare
Rebased to fix merge conflicts |
Moving this to draft given it is dependant on #28016 |
27781fe
to
fa9a0de
Compare
Moving out from drat given #28016 was recently merged. This comment is still outstanding, and I'd love some feedback on it: #29605 (comment) |
fa9a0de
to
4342d73
Compare
🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the Possibly this is due to a silent merge conflict (the changes in this pull request being Leave a comment here, if you need help tracking down a confusing failure. |
4342d73
to
33ddd1b
Compare
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.
Re-tested 33ddd1b. Bumping of timeout seems blocking.
The current behavior of seednode fetching is pretty eager: we do it as the first step under `ThreadOpenNetworkConnections` even if some peers may be queryable from our addrman. This poses two potential issues: - First, if permanently set (e.g. running with seednode in a config file) we'd be signaling such seed every time we restart our node - Second, we will be giving the seed node way too much influence over our addrman, populating the latter even with data from the former even when unnecessary This changes the behavior to only add seednodes to `m_addr_fetch` if our addrman is empty, or little by little after we've spent some time trying addresses from our addrman. Also, seednodes are added to `m_addr_fetch` in random order, to avoid signaling the same node in case more than one seed is added and we happen to try them over multiple restarts
ecded92
to
138a2e2
Compare
138a2e2
to
1ed818a
Compare
1ed818a
to
f3c4c4b
Compare
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.
re-ACK f3c4c4b
Ran test/functional/p2p_seednode.py
15 times to confirm robustness against timeouts.
Also ran functional tests with -extended --exclude=feature_dbcrash
with no failures.
Still urge you to do something like f9bfc58 from #29605 (comment) (still cherry-picks cleanly). Narrowing state carried around to when it is actually used is cleaner and more respectful to others reading through CConnman
, so they don't have to figure out where that extra m_seed_nodes
-member is accessed (+ to RAM that no longer needs to make room for unused state). Maybe it looks a bit more messy around your current change, but it reduces cognitive load/complexity for the rest of the code by reducing "live state". It's a bit like leaving a local variable mutable instead of const
at the top of a long function even though it is never changed after initialization.
Avoids bloating CConnman with state that is only used during startup.
Adds functional tests to test the interaction between seednode and the AddrMan
f3c4c4b
to
b41bbd5
Compare
@cbergqvist I took your suggestion from #29605 (comment) |
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.
re ACK b41bbd5
Passed functional tests (with --extended --exclude=feature_dbcrash
).
This is a follow-up of #28016 motivated by #28016 (review) and #28016 (comment).
The current behavior of seednode fetching is pretty eager: we do it as the first step under
ThreadOpenNetworkConnections
even if some peers may be queryable from our addrman. This poses two potential issues:This changes the behavior to only add seednodes to
m_addr_fetch
if our addrman is empty, or little by little after we've spent some time trying addresses from our addrman. Also, seednodes are added tom_addr_fetch
in random order, to avoid signaling the same node in case more than one seed is added and we happen to try them over multiple restarts