Skip to content

SerialBLEInterface receive queue is shared across tasks without synchronization #2923

Description

@hermes-gadget

SerialBLEInterface::onWrite appends to recv_queue from the BLE callback task while checkRecvFrame reads, decrements, and shifts the same array from the Arduino loop task. recv_queue_len and records have no critical section or SPSC publication discipline.

This can lose or corrupt closely spaced companion frames. A focused fix should protect receive queue publication/drain with an ESP32 critical section (including clear/reset), while keeping send queue behavior unchanged, and add a bounded queue model/stress test where feasible.

Discovered while auditing hermes-gadget/SigurdOS-tdeck (tracking issue hermes-gadget/SigurdOS-tdeck#813).

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