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

Filter out disconnected peers when fetching available peers #4269

Merged
merged 7 commits into from
Aug 23, 2022

Conversation

fab-10
Copy link
Contributor

@fab-10 fab-10 commented Aug 17, 2022

Signed-off-by: Fabio Di Fabio fabio.difabio@consensys.net

PR description

Currently a peer that is marked as disconnected can be returned when asking EthPeers for available peers, but returning a disconnected peer is not useful and potentially a cause of problems since all tasks will fail on it.
Not sure how much this affect peer selection in the real world, but in unit tests it happens to choose a disconnected peer for request.
In any case it seems reasonable to add this check, and we can evaluate if we also need to require that a peer is fully validated, before returning it as available

Fixed Issue(s)

Documentation

  • I thought about documentation and added the doc-change-required label to this PR if
    updates are required.

Changelog

return streamAllPeers().filter(EthPeer::readyForRequests);
return streamAllPeers()
.filter(EthPeer::readyForRequests)
.filter(peer -> !peer.isDisconnected());
Copy link
Contributor

Choose a reason for hiding this comment

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

seems sensible enough. This would be additional protection from a race between besu disconnecting a peer and subsequently responding to that disconnect?

Copy link
Contributor

Choose a reason for hiding this comment

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

makes sense to me!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No sure I got your question, but this part is not affecting the way we process incoming messages

Copy link
Contributor

@pinges pinges left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
… for requests

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
@fab-10 fab-10 force-pushed the available-peer-is-connected branch from d2b07b9 to 308abaa Compare August 23, 2022 12:31
@fab-10 fab-10 marked this pull request as ready for review August 23, 2022 12:31
Copy link
Contributor

@matkt matkt left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Copy link
Contributor

@macfarla macfarla left a comment

Choose a reason for hiding this comment

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

LGTM

return streamAllPeers().filter(EthPeer::readyForRequests);
return streamAllPeers()
.filter(EthPeer::readyForRequests)
.filter(peer -> !peer.isDisconnected());
Copy link
Contributor

Choose a reason for hiding this comment

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

makes sense to me!

@macfarla macfarla merged commit b3b8e0a into hyperledger:main Aug 23, 2022
@macfarla macfarla added the 22.7.2 label Sep 4, 2022
garyschulte pushed a commit to garyschulte/besu that referenced this pull request Sep 7, 2022
…ger#4269)

* Filter out disconnected peers when fetching available peers

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
garyschulte pushed a commit to garyschulte/besu that referenced this pull request Sep 7, 2022
…ger#4269)

* Filter out disconnected peers when fetching available peers

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
garyschulte pushed a commit to garyschulte/besu that referenced this pull request Sep 7, 2022
…ger#4269)

* Filter out disconnected peers when fetching available peers

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: garyschulte <garyschulte@gmail.com>
eum602 pushed a commit to lacchain/besu that referenced this pull request Nov 3, 2023
…ger#4269)

* Filter out disconnected peers when fetching available peers

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
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.

5 participants