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).
SerialBLEInterface::onWriteappends torecv_queuefrom the BLE callback task whilecheckRecvFramereads, decrements, and shifts the same array from the Arduino loop task.recv_queue_lenand 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).