Skip to content

dash-spv: an ignored request is held for minutes while its peer keeps answering other requests #1230

Open

Description

@xdustinface

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

A request only expires when its peer has made no progress for 10s. Broker::progress (network/broker.rs:180-188, called at network/manager.rs:1153-1162) resets last_progress on every on-wire request of a peer whenever that peer sends a CFilter, CFHeaders, Block, Headers or Headers2, and Broker::expire (network/broker.rs:201) only fires 10s after that. OnWire.sent is only read by hedge for blocks, so no request has a deadline of its own. One request the peer ignores therefore waits until the whole peer goes idle, with no upper bound. After expiry the retry can also be routed straight back to the peer that ignored it.

Evidence. The benchmark runs are 12 interleaved full testnet syncs of the #902 head 39eef40d against dev 0dcdd823. The network code is byte-identical to what landed on dev.

  • One run: a CfHeaders request for 1148001 to 1150000 sat on 68.67.122.27 for 226.8s while that peer answered about 75,000 other messages. Filter headers were stuck the whole time, then everything up to the tip landed within about 2s of the expiry (unanswered after 2 attempts).
  • Another run: the tip CFilters(1580862) sat on one peer for 162s. Attempts 4 to 7 then all went to [2a0e:b781:55d1:f30b::] and expired at 668, 679, 690 and 701s.
  • Those two runs took 654s and 734s against batch medians of about 336s and 423s, and they account for most of the refactor's gap to dev in that benchmark.

Fix. Give each request its own deadline measured from OnWire.sent, separate from the per-peer liveness clock, and exclude the peer that just let a request expire when re-routing it. Related: #1228.

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