mirror of
https://github.com/esphome/esphome.git
synced 2026-09-15 09:08:41 +00:00
a28a6f7d934a905c907763fda31098a9616c5eec
The update task runs in a FreeRTOS thread on ESP32 and was writing directly to update_info_ std::string fields while the main loop reads them via API (as StringRef pointers into the string buffer), MQTT, web server, and Prometheus. This is undefined behavior that can cause use-after-free crashes when a string reallocation invalidates a StringRef held by the API serialization path. Move all update_info_ and state_ writes into the existing defer() callback so they execute on the main loop. The task now accumulates results in a local UpdateInfo struct and moves it into update_info_ in the deferred callback, eliminating the cross-thread data race with zero steady-state memory overhead.
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
594 MiB
Languages
C++
55.8%
Python
43.6%
C
0.3%
JavaScript
0.2%
