Skip to content

Conversation

@gmaxwell
Copy link
Contributor

If a node is offline failed outbound connection attempts will crank up
the addrman counter and effectively blow away our state.

This change reduces the problem by only counting attempts made while
the node believes it has outbound connections to at least two
netgroups.

Connect and addnode connections are also not counted, as there is no
reason to unequally penalize them for their more frequent
connections -- though there should be no real effect from this
unless their addnode configureation is later removed.

Wasteful repeated connection attempts while only a few connections are
up are avoided via nLastTry.

This is still somewhat incomplete protection because our outbound
peers could be down but not timed out or might all be on 'local'
networks (although the requirement for multiple netgroups helps).

@gmaxwell
Copy link
Contributor Author

I'm less sure if this one should be tagged for 0.10, PR #6029's penalty cap stops most of the bleeding (and prevents the addrman updates from being a regression); though the behavior this addresses is pretty bad.

@gmaxwell
Copy link
Contributor Author

On the second commit, using the acceptance of a block might be a better measure of onlineness; I didn't because its likely even slower (more conservative) than Good, and because addrman has no knowledge of the blockchain.

If there is a preference, I could add a call to addrman for letting it know that it's probably online as of a particular time. If I did that I could probably drop the first commit entirely-- incrementing once per block is probably strong enough to not need the other test. Opinions welcome.

@laanwj laanwj added the P2P label Apr 20, 2015
@laanwj
Copy link
Member

laanwj commented May 18, 2015

Re: checking if online, In my opinion (successful) network activity is the best measure. Accepting blocks is a different concern of the application, and can also happen through other sources (such as from disk, from RPC).

Needs rebase.

@sipa
Copy link
Member

sipa commented Jun 14, 2015

Needs rebase.

@ghost
Copy link

ghost commented Jun 14, 2015

Related #5886

@sipa
Copy link
Member

sipa commented Jun 16, 2015

@sipa
Copy link
Member

sipa commented Nov 13, 2015

Needs rebase.

@gmaxwell
Copy link
Contributor Author

oh wow, totally forgot about this.

@mcelrath
Copy link

This likely fixes #6903, I'll test.

@gmaxwell
Copy link
Contributor Author

I'll rebase.

If a node is offline failed outbound connection attempts will crank up
 the addrman counter and effectively blow away our state.

This change reduces the problem by only counting attempts made while
 the node believes it has outbound connections to at least two
 netgroups.

Connect and addnode connections are also not counted, as there is no
 reason to unequally penalize them for their more frequent
 connections -- though there should be no real effect from this
 unless their addnode configureation is later removed.

Wasteful repeated connection attempts while only a few connections are
 up are avoided via nLastTry.

This is still somewhat incomplete protection because our outbound
 peers could be down but not timed out or might all be on 'local'
 networks (although the requirement for multiple netgroups helps).
This slows the increase of the nAttempts in addrman while partitioned,
 even if the node hasn't yet noticed the partitioning.
@gmaxwell
Copy link
Contributor Author

Rebased.

@laanwj
Copy link
Member

laanwj commented Nov 27, 2015

@mcelrath any testing results yet?

@sipa
Copy link
Member

sipa commented Apr 10, 2016

Needs rebase.

@gmaxwell
Copy link
Contributor Author

@sipa rebased at https://github.com/gmaxwell/bitcoin/tree/addrman_offline_attempts but github hasn't picked it up because I'd previously removed the branch in my repository. ... should I just close this? it seems to be going nowhere.

@dcousens
Copy link
Contributor

concept ACK

@sipa
Copy link
Member

sipa commented Apr 11, 2016

@gmaxwell Just close and reopen?

@laanwj laanwj closed this Apr 15, 2016
@laanwj
Copy link
Member

laanwj commented Apr 15, 2016

I tried to close and reopen but it's not letting me reopen: "The repository that submitted this pull request has been deleted"

gmaxwell wants to merge 2 commits into bitcoin:master from unknown repository

Either it's getting the wrong information or you've deleted more than just the branch

@maflcko
Copy link
Member

maflcko commented Apr 15, 2016

The branch must be at the same commit as it was at the time of closing, so this can not work anyway...

You can use https://github.com/bitcoin/bitcoin/compare/master...gmaxwell:addrman_offline_attempts?expand=1 to open a fresh pull and link to this one in the pull body.

@gmaxwell
Copy link
Contributor Author

Reopened as #8065 -- sorry, didn't see the closure and comments until now.

@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants