Commit Graph
26230 Commits
Author SHA1 Message Date
J. Nick KostonandJ. Nick Koston f2dee1433c Place backtrace_count before array for forward compatibility
Moving backtrace_count before the variable-length backtrace array
ensures magic, pc, and count are at fixed offsets regardless of
MAX_BACKTRACE value. This makes the .noinit data readable across
firmware versions that may change the max backtrace depth.

Co-Authored-By: J. Nick Koston <nick@koston.org>
2026-03-11 11:21:05 -10:00
J. Nick KostonandJ. Nick Koston f37610bfe1 Eliminate duplicate BSS struct, read directly from .noinit data
Saves 76 bytes of RAM by removing the validated BSS copy and reading
directly from the .noinit struct after magic validation. A single bool
tracks whether valid crash data was found this boot.

Co-Authored-By: J. Nick Koston <nick@koston.org>
2026-03-11 11:19:40 -10:00
J. Nick Koston 7acf3f77c4 Increase max backtrace depth from 8 to 16
8 frames was cutting off useful call stack information. 16 frames
costs an additional 32 bytes of .noinit RAM and covers typical
ESPHome call chains which can be 10-12 frames deep.
2026-03-11 11:06:15 -10:00
J. Nick Koston 5adae52819 Add stacktrace decoding to API log path
The esphome logs command via API wasn't running process_stacktrace
on received log lines, so crash handler backtrace addresses were
displayed but not decoded with addr2line.
2026-03-11 11:05:52 -10:00
J. Nick Koston a80cc50b8f fix not survive 2026-03-11 10:55:00 -10:00
J. Nick Koston 9f61331187 Address Copilot review: static linkage + keep valid flag
- Make s_raw_crash_data static with inline .noinit definition (no extern needed)
- Remove valid=false clearing from crash_handler_log() so both serial (boot)
  and API (subscribe) paths can emit the crash data
2026-03-11 10:46:49 -10:00
J. Nick Koston 84813ded94 Add test for ESP32 crash handler stacktrace decoding 2026-03-11 10:43:52 -10:00
J. Nick Koston 1c6dd56512 Address review feedback
- Clear valid flag after logging to prevent re-logging on API reconnects
- Cache esp_cpu_process_stack_pc result to avoid redundant call
- Remove unused <cstdint> include from header
2026-03-11 10:38:49 -10:00
J. Nick Koston 3a7a552f0d [esp32] Add crash handler to capture and report backtrace across reboots
When an ESP32 crashes, the backtrace is printed to UART and lost.
Users without a serial cable never see this diagnostic information.

This adds a crash handler that:
- Intercepts esp_panic_handler() via --wrap linker flag
- Captures the faulting PC and backtrace into .noinit memory
- Supports both Xtensa (ESP32/S2/S3) and RISC-V (C3/C6/H2/C2)
- Logs crash data at boot via ESP_LOGE (serial output)
- Re-logs when HA subscribes to logs (visible in HA log viewer)
- Adds CLI stacktrace decoding for the new log format
2026-03-11 10:34:00 -10:00
Jonathan SwobodaandClaude Opus 4.6 409640c0ee [esp32_hosted] Bump esp_hosted to 2.12.1 (#14708)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 16:30:44 -04:00
Jesse Hills 822c9161c6 Merge branch 'beta' into dev 2026-03-12 09:15:50 +13:00
Jesse Hills ad198fd77b Merge pull request #14702 from esphome/bump-2026.3.0b1
2026.3.0b1
2026.3.0b1
2026-03-12 09:15:11 +13:00
J. Nick Koston 2e179f2047 Merge branch 'fix-esp8266-settimeofday' into integration 2026-03-11 09:45:34 -10:00
J. Nick Koston 058146a41f Merge branch 'fix-lwip-pcb-use-after-free' into integration 2026-03-11 09:45:30 -10:00
J. Nick Koston a11f3b6971 [socket] Don't call tcp_recv/tcp_err on listen PCBs
tcp_pcb_listen is a smaller struct than tcp_pcb — calling tcp_recv()
or tcp_err() on it writes past the struct boundary. Revert the listen
PCB close to plain tcp_close(), which is synchronous for listen PCBs
(no async callbacks to worry about).
2026-03-11 09:45:02 -10:00
J. Nick Koston d6db522b1d [time] Fix settimeofday() failure on ESP8266
ESP8266's settimeofday() returns EINVAL (22) directly as the return
value when the timezone parameter is non-NULL, rather than following
POSIX convention of returning -1 and setting errno. The previous
fallback code checked errno == EINVAL which never matched because
errno was never set, so the retry with nullptr never triggered.

Fix by always passing nullptr on ESP8266 since the platform requires it.
2026-03-11 09:40:23 -10:00
J. Nick Koston 02af12c465 Merge branch 'fix-lwip-pcb-use-after-free' into integration 2026-03-11 09:31:27 -10:00
dependabot[bot] a060f175ad Bump actions/download-artifact from 8.0.0 to 8.0.1 (#14705)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-11 09:28:46 -10:00
dependabot[bot] 73f305ff9c Bump tornado from 6.5.4 to 6.5.5 (#14704)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-11 09:28:19 -10:00
J. Nick Koston 4260ca4b50 [socket] Fix use-after-free in LWIP PCB close/abort path
Clear LWIP callbacks (tcp_arg, tcp_recv, tcp_err) before calling
tcp_close() or tcp_abort() to prevent use-after-free.

After tcp_close(), the PCB remains alive during the TCP close
handshake (FIN_WAIT, TIME_WAIT states). If LWIP calls recv/err
callbacks during this period and the socket object has already
been destroyed, the callback writes to freed memory, corrupting
the heap.

This was observed as umm_malloc_core crashes on ESP8266 during
rapid API client connect/disconnect cycles — the heap free-list
got corrupted by a dangling callback writing to a freed
LWIPRawImpl object.

Extract pcb_detach_abort() and pcb_detach_close() helpers to
ensure all close/abort sites consistently clear callbacks first.
2026-03-11 09:26:51 -10:00
J. Nick Koston 395f6d7182 Merge remote-tracking branch 'upstream/dev' into integration 2026-03-11 09:14:31 -10:00
Jesse Hills b6ff7185e7 [ci] Dont run codeowners workflows on release or beta PRs (#14703) 2026-03-12 08:04:07 +13:00
J. Nick Koston 928f6f1866 [ci] Add PR title check for unescaped angle brackets (#14701) 2026-03-12 07:57:43 +13:00
J. Nick Koston 6cc1d191fd Merge remote-tracking branch 'upstream/dev' into integration 2026-03-11 08:46:55 -10:00
Jesse Hills 02f7aee680 Bump version to 2026.3.0b1 2026-03-12 07:34:53 +13:00
Jesse Hills e7c3277eeb Bump version to 2026.4.0-dev 2026-03-12 07:34:53 +13:00
Kevin Ahrendt bef5e4de9c [speaker_source] Add announcement pipeline (#14654) 2026-03-11 08:29:17 -10:00
04bcd9f56b [dashboard] Use sys.executable for dashboard subprocess commands (#14698)
Co-authored-by: Jonathan Swoboda <swoboda1337@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2026-03-11 14:25:36 -04:00
Jonathan SwobodaandClaude Opus 4.6 03c0ce704b Bump pyupgrade to v3.21.2 for Python 3.14 compatibility (#14699)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 08:22:48 -10:00
Kevin Ahrendt b27165a842 [speaker_source] Add shuffle support (#14653) 2026-03-11 08:11:00 -10:00
3d4ebe74ce [sensirion_common] Use SmallBufferWithHeapFallback helper (#14270)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
2026-03-11 08:00:42 -10:00
Kevin Ahrendt 4e16f270a3 [speaker_source] Add playlist management (#14652) 2026-03-11 07:47:58 -10:00
J. Nick Koston a0e162912c safety 2026-03-11 00:00:52 -10:00
J. Nick Koston 1131af1690 safety 2026-03-10 23:59:25 -10:00
J. Nick Koston 6fb00baa29 Merge remote-tracking branch 'upstream/dev' into socket-lwip-raw-udp 2026-03-10 23:57:51 -10:00
J. Nick Koston 9977dd7295 Merge branch 'fast-nodelay' into integration 2026-03-10 22:40:32 -10:00
J. Nick Koston a9c2be5193 Check socket type before accessing pcb.tcp union member
Move the NETCONN_TCP type check before the pcb.tcp null check
to avoid reading the wrong union member on non-TCP sockets.
2026-03-10 22:39:36 -10:00
J. Nick Koston 17c144bed2 Merge branch 'fast-nodelay' into integration 2026-03-10 22:32:13 -10:00
J. Nick Koston ef9f34b9ab Include lwip_fast_select.h for esphome_lwip_set_nodelay declaration
The forward declaration of struct lwip_sock alone is not enough -
the fast path in setsockopt() needs the function declaration too.
2026-03-10 22:31:48 -10:00
J. Nick Koston f9fd5fa0ad Include lwip_fast_select.h for esphome_lwip_set_nodelay declaration
The forward declaration of struct lwip_sock alone is not enough -
the fast path in setsockopt() needs the function declaration too.
2026-03-10 22:31:43 -10:00
J. Nick Koston 0df4fda9e5 Merge branch 'fast-nodelay' into integration 2026-03-10 22:29:42 -10:00
J. Nick Koston 426251f705 Address review: add TCP type check and null optval guard
- Check NETCONNTYPE_GROUP is NETCONN_TCP before accessing tcp_pcb
- Add optval != nullptr guard before dereferencing in fast path
2026-03-10 22:28:08 -10:00
J. Nick Koston 0e95504b48 Address review: add TCP type check and null optval guard
- Check NETCONNTYPE_GROUP is NETCONN_TCP before accessing tcp_pcb
- Add optval != nullptr guard before dereferencing in fast path
2026-03-10 22:27:59 -10:00
J. Nick Koston 15e981e6db Merge branch 'fast-nodelay' into integration 2026-03-10 22:17:35 -10:00
J. Nick Koston c530e52669 [socket] Fast path for TCP_NODELAY bypass lwip_setsockopt overhead
On ESP32 with CONFIG_LWIP_TCPIP_CORE_LOCKING, bypass lwip_setsockopt()
for TCP_NODELAY by directly modifying tcp_pcb->flags under the TCPIP
core lock. This eliminates ~1091 bytes of overhead per call (socket
lookups, hook, switch cascade, refcounting) for what is just a single
bit flip.

The API frame helper toggles Nagle's algorithm on every message send
via set_nodelay_for_message(), making this a hot path. The fast path
reduces set_nodelay_raw_ from calling the full lwip_setsockopt to just
acquiring the mutex, loading 3 pointers, and flipping the TF_NODELAY
bit.

Only enabled when both USE_LWIP_FAST_SELECT (cached lwip_sock pointer)
and CONFIG_LWIP_TCPIP_CORE_LOCKING (real mutex protection) are
available. Falls back to the standard setsockopt call otherwise.
2026-03-10 22:08:22 -10:00
J. Nick Koston 567617b95f Merge remote-tracking branch 'upstream/fix-ble-client-disconnect-race' into integration 2026-03-10 21:30:51 -10:00
J. Nick Koston 5362966848 Merge branch 'dev' into fix-ble-client-disconnect-race 2026-03-10 21:29:15 -10:00
c52a48ed38 [multiple] Convert static function locals to member variables (#14689)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2026-03-11 07:11:46 +00:00
236f6b1935 [micronova] Add command queue (#12268)
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
Co-authored-by: edenhaus <edenhaus@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
Co-authored-by: J. Nick Koston <nick+github@koston.org>
2026-03-11 19:52:43 +13:00
J. Nick Koston e8e700a683 [socket] Fix RP2040 heap corruption from malloc in lwip accept callback (#14687) 2026-03-11 19:51:54 +13:00