Skip to content

dash-spv: a peer whose filter replies wait in our own backlog is kicked as stalled #1234

Closed

Description

@xdustinface

All paths are under dash-spv/src/ at 8dde9d0c (dev after #902).

The byte charge for a filter or filter header request settles when the reply arrives (network/peer.rs:484), but its registry entry only leaves when the sync manager processes the reply and calls request_answered (sync/filters/sync_manager.rs:145, sync/filter_headers/sync_manager.rs:58). Blocks settle on arrival instead (network/broker.rs:168). When the filter manager lags behind its backlog, an idle peer that already delivered everything still has keys on the wire, and Broker::expire (network/broker.rs:193) flags it for a kick and requeue_from re-sends all of its keys.

Evidence. In a testnet benchmark run a kick logged CFilters(1423001|1427001|1428001|1431001|1448001) unanswered after 2 attempts. All five batches then completed 0.3 to 1.8s later, while no replacement peer was connected and no new bytes had arrived, so their replies were already waiting in our queue. In another run about 28 of 728 re-queued keys were in the same state, the rest were genuinely needed.

Two side effects in the same path:

  • Broker::answered (network/broker.rs:113-117) removes a key that is back in Queued but leaves its message in the queue, so the batch is downloaded again, untracked.
  • requeue_from wakes the router before the culprits are removed from the connected set. Right after one kick the router logged 75 sends with peers=3, the peers being closed.

Fix. Settle filter and filter header keys on arrival like blocks (or skip the registry check for peers with nothing in flight), drop the queued message when a re-queued key is answered, and remove kicked peers before waking the router.

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