You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
With ESPNow remote and no wifi WLED reboots every 15-20min (fixed in 17.0.0-dev) #5614
bugconfirmedThe bug is reproducable and confirmedfixed in sourceThis issue is unsolved in the latest release but fixed in masterworkaroundThe issue contains a workaround
Without wifi to connect to the device is rebooting every 15-20min, if the AP it connects to is available then it appears to be stable over multiple days.
Runs fine on 14. As per #3685 (comment) this bug is being opened.
Yes, but it's a test. I want to know if esp-now freaks out without wifi connection (the esp-now service is still running even when you don't press buttons on your remote)
@softhack007 — here's a thorough analysis of the crash and the upstream library's known problems:
Root Cause Analysis
The Crash
The StoreProhibited exception at EXCVADDR: 0x00000004 inside uxListRemove is a classic stale/dangling TaskHandle_t crash. At offset 4 of a FreeRTOS TCB lies the xStateListItem member; writing to it means the TCB was already freed (the task deleted itself or was already deleted), but espnowTxTask still holds the old pointer.
At t=1381s: free DRAM = 19 144 bytes (−7 KB in 30 s)
At t=1411s: free DRAM = 26 444 bytes (recovers slightly — but the leak is real and cumulative across longer runs)
This matches the pattern of xTaskCreate allocating stack+TCB on each begin(), and vTaskDelete on a stale handle not actually freeing anything — the stack of the previously created task leaks.
Rapid stop/start cycling (~every 18 s):
ESP-NOW stopping.
... (WiFi init) ...
ESP-NOW initing in STA mode.
WLED calls initConnection() roughly every 18 s when the configured WiFi AP is unreachable. Each cycle triggers a stop()→begin() pair.
espnowTxTask handle is never reset to NULL:
If begin() fails part-way through (e.g. xTaskCreate returns an error because there's not enough heap), espnowTxTask retains its old stale value from the previous successful begin(). The next stop() then passes this dangling pointer to vTaskDelete().
Known Issue in the Upstream Library
Repeating FreeRTOS task creation and deletion without a pause is known to crash the ESP32 FreeRTOS implementation. Adding a pause of at least 3 ticks after vTaskDelete is required for safe operation.
A TaskHandle_t is a pointer to an internal task structure; when vTaskDelete is called, that structure is freed — meaning the handle now points to effectively uninitialized memory, and any further operation on it is undefined.
The upstream gmag11/QuickESPNowstop() function has no guard against:
Calling vTaskDelete on an already-deleted handle
Calling vTaskDelete on a NULL handle (from a failed xTaskCreate)
Leaving handles non-NULL after deletion
The Fix
The QuickEspNow::stop() in the fork needs at minimum:
And begin() / start() must also set handles to nullptr before xTaskCreate, and check the return value:
espnowTxTask = nullptr; // clear before createif (xTaskCreate(..., &espnowTxTask, ...) != pdPASS) {
// handle error — do not proceed
}
Recommendation
It would be worth:
Patching the fork (blazoncek/QuickESPNow) with the NULL-guards above.
Reducing the stop/start frequency on WLED's side — e.g. avoid restarting ESP-NOW if it was already stopped, or add a minimum interval between initConnection() calls when the AP is known to be unreachable.
Checking the begin() return value in WLED's ESP-NOW init code and skipping stop() if begin() never succeeded.
@coderabbitai every call of QuickEspNow::begin() seems to create two new FreeRTOS queues, but I did not see where these queuey would be deleted in QuickEspNow::end(). Please check if this might explain the RAM decrease over time.
I have a working version to replace quickespnow, it's just a bit "buggy" on ESP8266, need to figure out why - most likely need some addintonal msg buffer. It works flawless on ESP32 and C3 in my test.
@hez thanks for the feedback. does everything ESPNow related still work as it should? I removed the buggy library and rewrote a new ESPNow "driver" from scratch.
@hez thanks for the feedback. does everything ESPNow related still work as it should? I removed the buggy library and rewrote a new ESPNow "driver" from scratch.
I am only using a ESPNow Remote, don't have any other devices. From my testing so far, it seems to work.
I am unsure how the channel gets set, the ESPNow channel needs to be the same as the wifi channel the WLED device connects to. Thoughts?
The way I have set it up ESPNow follows the wifi channel - either of the wifi or the AP. I am not sure what happens if you have both disabled or if that is even an allowed state. The remote sends its message on every channel so it does not really matter what channel WLED is actually on but if the channel it ends up using has a lot of traffic, the remote messages can drown in noise.
The way I have set it up ESPNow follows the wifi channel - either of the wifi or the AP. I am not sure what happens if you have both disabled or if that is even an allowed state. The remote sends its message on every channel so it does not really matter what channel WLED is actually on but if the channel it ends up using has a lot of traffic, the remote messages can drown in noise.
Strange, that hasn't been my experience, even in quiet environments if the WLED device is connected to wifi the remote has to be pressed for a long time or multiple times. If the WLED device is disconnected from wifi the remote works as expected.
@hez do you have "WiFi sleep" enabled in wifi settings? If you do the ESP will power down its antenna between beacon intervals once connected to a wifi, meaning it will miss a lot of messages.
@hez do you have "WiFi sleep" enabled in wifi settings? If you do the ESP will power down its antenna between beacon intervals once connected to a wifi, meaning it will miss a lot of messages.
That does indeed look to solve it, totally missed its a "disabled" check instead of the other way round. Thanks!
changed the title [-]With ESPNow remote and no wifi WLED reboots every 15-20min[/-][+]With ESPNow remote and no wifi WLED reboots every 15-20min (fixed in 17.0.0-dev)[/+]on Jul 4, 2026
bugconfirmedThe bug is reproducable and confirmedfixed in sourceThis issue is unsolved in the latest release but fixed in masterworkaroundThe issue contains a workaround
Activity
hez commentedon May 14, 2026
not sure if this is related: #5336 I will have to try disabling mdns
softhack007 commentedon May 14, 2026
@hez please also check if stability improves without the esp-now remote (remove it from settings).
hez commentedon May 14, 2026
Without a wifi AP and no remote the lights will become very hard to control. 😬
softhack007 commentedon May 14, 2026
Yes, but it's a test. I want to know if esp-now freaks out without wifi connection (the esp-now service is still running even when you don't press buttons on your remote)
hez commentedon May 14, 2026
I tested it a few times here and quite repeatedly with the ESPNow remote set it reboots.
[-]When no wifi WLED reboots every 15-20min[/-][+]With ESPNow remote and no wifi WLED reboots every 15-20min[/+]softhack007 commentedon May 14, 2026
Ok, managed to get a crash dump with the latest source code in
mainthe condition seems to be
StoreProhibited (Exception 29: Access to invalid address: STORE (wild pointer?))
Core: 1
PC: 0x4008ec9b
Fault Address: 0x00000004
Fault Code: 29
The crash is inside the
QickEspNowexternal library:softhack007 commentedon May 14, 2026
@coderabbitai please review the main repo of QuickEspNow for known problems with frequent start/stop in AP mode. We are using this fork of the library https://github.com/blazoncek/QuickESPNow.git#optional-debug. Also check the debug output above (WLED_DEBUG + CORE_DEBUG_LEVEL=1) for "smoking guns" that might help explain the problem.
coderabbitai commentedon May 14, 2026
@softhack007— here's a thorough analysis of the crash and the upstream library's known problems:Root Cause Analysis
The Crash
The
StoreProhibitedexception atEXCVADDR: 0x00000004insideuxListRemoveis a classic stale/danglingTaskHandle_tcrash. At offset 4 of a FreeRTOS TCB lies thexStateListItemmember; writing to it means the TCB was already freed (the task deleted itself or was already deleted), butespnowTxTaskstill holds the old pointer.The call chain is:
Smoking Guns in the Debug Log
Memory leak per stop/start cycle:
t=1351s: free DRAM = 26 236 bytest=1381s: free DRAM = 19 144 bytes (−7 KB in 30 s)t=1411s: free DRAM = 26 444 bytes (recovers slightly — but the leak is real and cumulative across longer runs)xTaskCreateallocating stack+TCB on eachbegin(), andvTaskDeleteon a stale handle not actually freeing anything — the stack of the previously created task leaks.Rapid stop/start cycling (~every 18 s):
WLED calls
initConnection()roughly every 18 s when the configured WiFi AP is unreachable. Each cycle triggers astop()→begin()pair.espnowTxTaskhandle is never reset to NULL:If
begin()fails part-way through (e.g.xTaskCreatereturns an error because there's not enough heap),espnowTxTaskretains its old stale value from the previous successfulbegin(). The nextstop()then passes this dangling pointer tovTaskDelete().Known Issue in the Upstream Library
Repeating FreeRTOS task creation and deletion without a pause is known to crash the ESP32 FreeRTOS implementation. Adding a pause of at least 3 ticks after
vTaskDeleteis required for safe operation.A
TaskHandle_tis a pointer to an internal task structure; whenvTaskDeleteis called, that structure is freed — meaning the handle now points to effectively uninitialized memory, and any further operation on it is undefined.The upstream
gmag11/QuickESPNowstop()function has no guard against:vTaskDeleteon an already-deleted handlevTaskDeleteon a NULL handle (from a failedxTaskCreate)The Fix
The
QuickEspNow::stop()in the fork needs at minimum:And
begin()/start()must also set handles tonullptrbeforexTaskCreate, and check the return value:Recommendation
It would be worth:
blazoncek/QuickESPNow) with the NULL-guards above.initConnection()calls when the AP is known to be unreachable.begin()return value in WLED's ESP-NOW init code and skippingstop()ifbegin()never succeeded.softhack007 commentedon May 14, 2026
more problems .... i've added
nullptrchecks into the library (my own local copy), but now the crash is just in another locationThe DRAM decrease is unusual 🤔 We know that any ESP32 will get unstable if the smallest HEAP chunk is less than 10Kb.
softhack007 commentedon May 14, 2026
@coderabbitai every call of QuickEspNow::begin() seems to create two new FreeRTOS queues, but I did not see where these queuey would be deleted in QuickEspNow::end(). Please check if this might explain the RAM decrease over time.
https://github.com/blazoncek/QuickESPNow/blob/193e991642cbffe1d44e7445a0a34445f69a67d8/src/QuickEspNow_esp32.cpp#L317
16 remaining items
DedeHai commentedon May 16, 2026
I have a working version to replace quickespnow, it's just a bit "buggy" on ESP8266, need to figure out why - most likely need some addintonal msg buffer. It works flawless on ESP32 and C3 in my test.
DedeHai commentedon May 17, 2026
@hez can you please test if https://github.com/wled/WLED/actions/runs/25970426965 works in your scenario?
hez commentedon May 18, 2026
Tested that build, been running it for 12hrs without wifi connected and ESPNow configured. Looks stable so far! 👍
DedeHai commentedon May 18, 2026
@hez thanks for the feedback. does everything ESPNow related still work as it should? I removed the buggy library and rewrote a new ESPNow "driver" from scratch.
hez commentedon May 18, 2026
I am only using a ESPNow Remote, don't have any other devices. From my testing so far, it seems to work.
I am unsure how the channel gets set, the ESPNow channel needs to be the same as the wifi channel the WLED device connects to. Thoughts?
DedeHai commentedon May 18, 2026
The way I have set it up ESPNow follows the wifi channel - either of the wifi or the AP. I am not sure what happens if you have both disabled or if that is even an allowed state. The remote sends its message on every channel so it does not really matter what channel WLED is actually on but if the channel it ends up using has a lot of traffic, the remote messages can drown in noise.
hez commentedon May 18, 2026
Strange, that hasn't been my experience, even in quiet environments if the WLED device is connected to wifi the remote has to be pressed for a long time or multiple times. If the WLED device is disconnected from wifi the remote works as expected.
DedeHai commentedon May 19, 2026
@hez do you have "WiFi sleep" enabled in wifi settings? If you do the ESP will power down its antenna between beacon intervals once connected to a wifi, meaning it will miss a lot of messages.
hez commentedon May 20, 2026
That does indeed look to solve it, totally missed its a "disabled" check instead of the other way round. Thanks!
[-]With ESPNow remote and no wifi WLED reboots every 15-20min[/-][+]With ESPNow remote and no wifi WLED reboots every 15-20min (fixed in 17.0.0-dev)[/+]