mirror of
https://github.com/torlando-tech/pyxis.git
synced 2026-03-29 05:19:50 +00:00
send_outgoing() on loopTask (core 1) calls write() which reads _connections, _clients, and _cached_rx_chars maps, while processPendingDisconnects() on the BLE task (core 0) erases from them — with no synchronization. This causes std::map red-black tree corruption, manifesting as LoadProhibited crashes in map rotate/insert operations (EXCVADDR=0x00000008). Protect all map accesses in write(), writeCharacteristic(), read(), enableNotifications(), getConnection(), getConnections(), and processPendingDisconnects() with _conn_mutex. The mutex is released before any blocking GATT operations (writeValue, readValue, subscribe) to avoid holding it during 10-30s NimBLE timeouts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>