Problem Description
After upgrading ~30 Sonoff S31 devices from 15.2.0 to 15.3.0, all devices with energy monitoring enabled experience a continuous slow heap drain and eventually crash with Exception 29. The crash triggers a reboot loop via MQTT retained messages.The issue is 100% reproducible across 20+ affected devices. It did not occur on 15.2.0.
Expected Behavior
Heap should remain stable (±1KB) during normal operation with energy monitoring active, as it did on 15.2.0.
Actual Behavior
After each reboot, heap starts at ~22–23KB and drains at approximately 1KB per 15 minutes:
t=0 min: Heap: 23KB
t=30 min: Heap: 22KB
t=45 min: Heap: 20KB
t=60 min: Heap: 18KB ← instability begins
t=90 min: Heap: ~14KB ← Exception 29 crash
{"StatusSTK":{"Exception":29,"Reason":"Exception","EPC":["4000df64","00000000","00000000"],"EXCVADDR":"00000000","DEPC":"00000000"}}
---
**Fleet Impact**
- **~20 out of 30 devices** showing Exception restart reason in Tasmota Device Manager
- All affected devices: Sonoff S31, 15.3.0, Core 2.7.8, SDK 2.2.2-dev(38a443e)
- All affected devices have **CSE7766 energy monitoring active**
- Devices **without** energy monitoring (non-S31) are **not** affected
- BootCount on worst device: **94** (before fix was applied)
---
**Steps to Reproduce**
1. Flash Sonoff S31 (CSE7766 energy chip) with Tasmota 15.3.0
2. Ensure energy monitoring is active (default for S31 module)
3. Monitor `Heap` value in STATE MQTT messages over 1–2 hours
4. Observe continuous ~1KB/15min heap drain
5. Device crashes with Exception 29 when heap falls below ~10KB
---
**STATUS 0 Output (affected device)**
Version: 15.3.0(tasmota)
Core: 2.7.8 / SDK: 2.2.2-dev(38a443e)
Module: Sonoff S31 (41)
Baudrate: 4800 / SerialConfig: 8E1 ← CSE7766 serial
RestartReason: Exception
BootCount: 94
Heap at boot: 22KB
ProgramSize: 655KB / CR: 347/699
---
**Configuration**
- Module: Sonoff S31 (Module 41)
- GPIO1: CSE7766 Tx / GPIO3: CSE7766 Rx
- PowerDelta: 0 (was 10 — separately caused MQTT spam issue, now fixed)
- TelePeriod: 300
- Sleep: 50
---
**Suspected Root Cause**
Two changes in 15.3.0 release notes appear related:
1. **`ESP8266 platform update from 2025.10.00 to 2026.02.00 (#24460)`** — platform toolchain update likely increased internal WiFi/TCP/serial buffer footprint, reducing available heap at boot from ~28KB (pre-15.3.0) to ~22KB
2. **`ESP8266 TasmotaSerial flush receive buffer on executing TasmotaSerial.flush()`** — directly affects the CSE7766 serial driver code path; a small per-transaction memory leak here would produce exactly the observed ~1KB/15min drain pattern
---
**Workaround**
Downgrading to 15.2.0 resolves the issue completely:
Backlog OtaUrl http://ota.tasmota.com/tasmota/release-15.2.0/tasmota.bin.gz; Upgrade 1
Additional Notes
WiFi signal strong (RSSI 88 / -56dBm) — not a WiFi issue
Issue persists even with PowerDelta 0, PowerRetain 0, all retain flags off
A separate but related trigger was discovered: PowerDelta 10 on 9W LED loads was causing per-second MQTT MARGINS spam that exhausted heap in minutes. Disabling PowerDelta eliminated the rapid crash but the slow underlying heap drain remained, confirming two separate issues
SaveCount: 1299 on worst device — evidence of thousands of crash-reboot cycles since Dec 2023 when 15.3.0 likely first tightened heap margins enough to expose the leak
Previous working version: 13.4.0 (direct upgrade to 15.3.0, intermediate versions not tested)
Problem Description
After upgrading ~30 Sonoff S31 devices from 15.2.0 to 15.3.0, all devices with energy monitoring enabled experience a continuous slow heap drain and eventually crash with Exception 29. The crash triggers a reboot loop via MQTT retained messages.The issue is 100% reproducible across 20+ affected devices. It did not occur on 15.2.0.
Expected Behavior
Heap should remain stable (±1KB) during normal operation with energy monitoring active, as it did on 15.2.0.
Actual Behavior
After each reboot, heap starts at ~22–23KB and drains at approximately 1KB per 15 minutes:
t=0 min: Heap: 23KB
t=30 min: Heap: 22KB
t=45 min: Heap: 20KB
t=60 min: Heap: 18KB ← instability begins
t=90 min: Heap: ~14KB ← Exception 29 crash
{"StatusSTK":{"Exception":29,"Reason":"Exception","EPC":["4000df64","00000000","00000000"],"EXCVADDR":"00000000","DEPC":"00000000"}}
Version: 15.3.0(tasmota)
Core: 2.7.8 / SDK: 2.2.2-dev(38a443e)
Module: Sonoff S31 (41)
Baudrate: 4800 / SerialConfig: 8E1 ← CSE7766 serial
RestartReason: Exception
BootCount: 94
Heap at boot: 22KB
ProgramSize: 655KB / CR: 347/699
Backlog OtaUrl http://ota.tasmota.com/tasmota/release-15.2.0/tasmota.bin.gz; Upgrade 1
Additional Notes
WiFi signal strong (RSSI 88 / -56dBm) — not a WiFi issue
Issue persists even with PowerDelta 0, PowerRetain 0, all retain flags off
A separate but related trigger was discovered: PowerDelta 10 on 9W LED loads was causing per-second MQTT MARGINS spam that exhausted heap in minutes. Disabling PowerDelta eliminated the rapid crash but the slow underlying heap drain remained, confirming two separate issues
SaveCount: 1299 on worst device — evidence of thousands of crash-reboot cycles since Dec 2023 when 15.3.0 likely first tightened heap margins enough to expose the leak
Previous working version: 13.4.0 (direct upgrade to 15.3.0, intermediate versions not tested)