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

[Net] Addrman offline attempts #1453

Merged
merged 2 commits into from
Mar 27, 2020

Conversation

Fuzzbawls
Copy link
Collaborator

Backport of bitcoin#8065

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).

Note: A future PR will focus on refactoring the layer 2 (masternode) methods to stop using ConnectNode() directly

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.
Copy link

@random-zebra random-zebra left a comment

Choose a reason for hiding this comment

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

ACK 40e4116

Copy link

@furszy furszy left a comment

Choose a reason for hiding this comment

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

utACK 40e4116

@furszy furszy merged commit 195d466 into PIVX-Project:master Mar 27, 2020
akshaynexus pushed a commit to ZENZO-Ecosystem/ZENZO-Core that referenced this pull request Mar 30, 2020
40e4116 Do not increment nAttempts by more than one for every Good connection. (Gregory Maxwell)
b988ce6 Avoid counting failed connect attempts when probably offline. (Gregory Maxwell)

Pull request description:

  Backport of bitcoin#8065

  > 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).

  Note: A future PR will focus on refactoring the layer 2 (masternode) methods to stop using `ConnectNode()` directly

ACKs for top commit:
  random-zebra:
    ACK 40e4116
  furszy:
    utACK 40e4116

Tree-SHA512: 96adadea1d214a2afcf5e43c13a4409ca3de1d81ae51225bda74eabda6a3435a7678c3826e3c3930e543b084de1f28a4a5a102ccd1e3ad3c01da4937f312941b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants