Skip to content

dash-spv: an idle peer is kicked on the first request it gets #1329

Closed

Description

@xdustinface

All paths are under dash-spv/src/ at c15bdbfc7 (dev).

The timeout monitor kicks and bans a healthy peer when its first request after a quiet spell goes out. Its per-peer check (network/manager.rs:1005-1018) flags a peer that has bytes in flight and whose byte counter has not risen for request_timeout(lag) (10 s minimum). The clock is the time since the peer last sent anything, not the time since it was given work. At the tip a peer can easily stay silent for more than 10 s. The next request sent to it then trips the check at the following TIMEOUT_CHECK tick, about one second later at most.

Evidence. A testnet run at 2d28ac4d5 (dev plus unrelated event changes), synced and idle at the tip:

11:04:05.346  router: sent 2 | peers=3            (CFHeaders + MnListDiff for the new block)
11:04:05.503  WARN request timeout: kicked 1 peer(s) {68.67.122.42 ...}, retried 1 request(s)
11:04:35.440  router: sent 1 | peers=3
11:04:35.502  WARN request timeout: kicked 1 peer(s) {85.209.243.6 ...}, retried 1 request(s)

Both peers showed in_flight=0 KB on every peer_speed line up to the send, so no leaked charge was involved (unlike #1219). Each kick also bans the peer with Ban::Kicked, so a long-running wallet slowly bans good nodes, one new block at a time. Whether a block triggers it depends on which peer the router picks and how long that peer has been quiet.

Fix. Reset the peer's progress entry when its in-flight bytes go from zero to non-zero, so the timeout counts from when the peer was given work. Related: #1228, whose kicked peers had also "stopped sending 10 to 18s before the kick".

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions