Skip to content

[receive] recv can potentially cause deep recursion #45

@bruingineer

Description

@bruingineer

Describe the bug
recv() can recursively call itself when handling certain recoverable conditions (e.g. timeouts, source discovery, or filtered packets). If these conditions persist, recursion can become unbounded, leading to deep call stacks, potential stack overflow, and hard-to-reason-about control flow. This also obscures termination conditions and makes error handling dependent on recursion depth rather than explicit logic.

Expected behaviour
recv() should use an explicit loop instead of recursion to retry or skip packets. Control flow should be iterative, with clearly defined exit conditions (successful packet receipt, timeout, or error), ensuring bounded stack usage and predictable behaviour consistent with the protocol’s receive semantics.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions