Skip to content

fix(client): a drained lane build can still re-send a topUp, or wait on locks, after its fetch ended #2520

Closed

Description

@thiras

Problem

#2513 ends a fetch for its lane builds as the drain starts. A build that reaches its openPool or topUp after that sends none. Two paths still behave as before.

  1. A nonce-collision re-send. send_top_up re-sends a topUp that lost its nonce, up to three more times, a quarter second apart (buyer_pool.rs). The fetch-end check runs before top_up, not before each re-send. A fetch that ends during the backoff still gets the re-send. The first send broadcast nothing, so this is a topUp the fetch did not need. It is recorded, not lost.
  2. Lock waits. A drained build takes the bundle-wide open_lock (lanes.rs) and the run's top_up_serial (funding.rs::escrow_top_up) before it checks the token. A sibling that holds either lock through its receipt wait (up to RECEIPT_TIMEOUT, 3 min) keeps the drained build waiting for the whole 30 s BUILD_DRAIN. The build then drops with the "lane builds still running" warning, though it would have sent nothing.

Fix direction

  1. Pass the token into top_up (or check it in the re-send loop) and refuse a re-send once it fires.
  2. Check ended before the lock waits, or race each lock against ended.cancelled(), so a drained build that has sent nothing ends at once.

Checks

  • A topUp whose first send collides on its nonce sends no re-send after the fetch ends.
  • A drained build queued behind a sibling's topUp receipt wait ends at once with FetchEnded.

Found in the review of the #2508/#2513/#2515/#2517 batch.

Activity

  1. self-assigned this
    on Oct 18, 2026
  2. added
    kind:bug
    rust
    prio:low
    area:payments
    on Oct 18, 2026
  3. moved this from Backlog to In progress in deCDNon Oct 18, 2026
  4. moved this from In progress to Done in deCDNon Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:paymentskind:bugprio:lowrust

Type

No type

Fields

Priority

None yet

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions