Skip to content

search_by_id: originator blocks forever if relayed node never responds #74

Description

@thep2p

Summary

In src/node/base_node.rs (BaseNode::search_by_id, lines ~83–140), the originator's search_by_id can block forever if the relayed node never responds.

Details

After relaying the request, the originator calls rx.recv() (line 121), which blocks indefinitely. If the downstream node crashes, drops the request, or the response is lost, the SyncSender is never used and recv() never returns. There is no timeout.

The nonce entry also stays in request_id_map forever in that scenario: the recv-error path (lines 130–138) only fires when the sender is dropped, not when a response is simply never sent.

Recommendation

  • Replace the unbounded rx.recv() with a bounded rx.recv_timeout(...).
  • On timeout, remove the nonce entry from request_id_map (same cleanup as the existing error path) and return an error.

Notes

Not introduced by #72 — pre-existing — but flagged during that PR's review as a good moment to address it.

Source: review comment on #72 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions