mirror of
https://github.com/esphome/esphome.git
synced 2026-09-01 02:26:01 +00:00
c694e96f24a5e7b047b08191ae1729dba29ab8ce
The synchronous logging path holds the main-task recursion guard around notify_listeners_, but the buffered drain in Logger::process_messages_ did not. When a message logged from a non-main thread was drained on the main loop and a listener (the API log forwarder, or a logger.on_message automation) logged again on the main task, that re-entrant log reused the shared tx_buffer_ and the API shared_write_buffer_ while they were still in use, corrupting the in-flight message; on ESP32 this surfaced as a StoreProhibited panic in the API send path. Hold a RecursionGuard on main_task_recursion_guard_ across the drain so re-entrant main-task logs are dropped there too, mirroring the synchronous path. Adds an integration test that drives the buffered drain with a re-entrant on_message log and verifies the buffered messages are delivered uncorrupted.
Description
ESPHome is a system to control your ESP8266/ESP32 by simple yet powerful configuration files and control them remotely through Home Automation systems.
Readme
Multiple Licenses
584 MiB
Languages
C++
56.1%
Python
43.3%
C
0.3%
JavaScript
0.2%
