[GH-ISSUE #1811] race condition on portal shutdown #1527

Closed
opened 2026-02-28 01:30:24 +03:00 by kerem · 0 comments
Owner

Originally created by @mnbf9rca on GitHub (Mar 28, 2025).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1811

My code executes the following sequence in case the portal times out:

  • Parameters cleaned up
  • Deregistered saveParamsCallback
  • Cleaning up parameters
  • Parameters cleaned up
  • Stopped AP

I've noticed random crashes and following the stack trace, i see it's at the line 966 of WiFiManager.cpp:

> ~/.platformio/packages/toolchain-xtensa-esp32/bin/xtensa-esp32-elf-addr2line -pfiaC -e .pio/build/m5stack-tough/firmware.elf 0x400e9a7c 0x400e9c0c 0x400d444e 0x400d4941 0x400f3dd9
0x400e9a7c: WiFiManager::shutdownConfigPortal() at /Users/rob/Downloads/git/m5-tough/.pio/libdeps/m5stack-tough/WiFiManager/WiFiManager.cpp:966
0x400e9c0c: WiFiManager::stopConfigPortal() at /Users/rob/Downloads/git/m5-tough/.pio/libdeps/m5stack-tough/WiFiManager/WiFiManager.cpp:2540
0x400d444e: doWiFiManager() at /Users/rob/Downloads/git/m5-tough/src/WiFiHelper.cpp:187
0x400d4941: loop() at /Users/rob/Downloads/git/m5-tough/src/main.cpp:72
0x400f3dd9: loopTask(void*) at /Users/rob/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp:50

As far as i can tell, there appears to be a race condition where the code attempts to make one final DNS request after the DNS server resources have already been cleaned up. The dnsServer pointer becomes invalid but the code still tries to access it.

Originally created by @mnbf9rca on GitHub (Mar 28, 2025). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1811 My code executes the following sequence in case the portal times out: - Parameters cleaned up - Deregistered saveParamsCallback - Cleaning up parameters - Parameters cleaned up - Stopped AP I've noticed random crashes and following the stack trace, i see it's at the line [966 of WiFiManager.cpp](https://github.com/tzapu/WiFiManager/blob/master/WiFiManager.cpp#L966): ``` > ~/.platformio/packages/toolchain-xtensa-esp32/bin/xtensa-esp32-elf-addr2line -pfiaC -e .pio/build/m5stack-tough/firmware.elf 0x400e9a7c 0x400e9c0c 0x400d444e 0x400d4941 0x400f3dd9 0x400e9a7c: WiFiManager::shutdownConfigPortal() at /Users/rob/Downloads/git/m5-tough/.pio/libdeps/m5stack-tough/WiFiManager/WiFiManager.cpp:966 0x400e9c0c: WiFiManager::stopConfigPortal() at /Users/rob/Downloads/git/m5-tough/.pio/libdeps/m5stack-tough/WiFiManager/WiFiManager.cpp:2540 0x400d444e: doWiFiManager() at /Users/rob/Downloads/git/m5-tough/src/WiFiHelper.cpp:187 0x400d4941: loop() at /Users/rob/Downloads/git/m5-tough/src/main.cpp:72 0x400f3dd9: loopTask(void*) at /Users/rob/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp:50 ``` As far as i can tell, there appears to be a race condition where the code attempts to make one final DNS request after the DNS server resources have already been cleaned up. The dnsServer pointer becomes invalid but the code still tries to access it.
kerem closed this issue 2026-02-28 01:30:24 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#1527
No description provided.