Repository navigation
Conversation
Owner
Author
|
Independent review of head What I checked
Findings
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #218
TNoderetries a failed connect every second forever. That is deliberate: an embedder may start peers in any order, and a peer that is down for a while must not take the node down. Giving up or throwing would break such embedders, so this PR keeps the retry loop and changes only what is reported.Chosen option: rate-limited, counted connect-error logging. It needs no new API or config and fits the library's existing
std::cerrlogging.Error connecting to 127.0.0.1:9000: connect: Connection refused (13 consecutive failures). The first 3 failures are logged, then every 10th, so a permanently failing peer shows a growing counter instead of an unbounded stream of identical lines.TNode::ConsecutiveConnectFailures()exposes the counter (not onINode) so an embedder or test can detect a stuck peer.Not done: backoff with a cap, and reporting a peer's bind failure at startup. Backoff changes reconnect latency for everyone, and a bind failure is only known to the peer's own process; neither fits a small non-breaking change. A failed-after-N error or callback can be built on the counter if wanted.
Test:
test_node_counts_connect_failureschecks that the counter grows while nobody listens and returns to 0 after a successful connect.Both this PR and the one for #219 touch
DoConnect()but different lines; whichever merges second should rebase trivially or with a small mechanical conflict.