-
Notifications
You must be signed in to change notification settings - Fork 7.6k
The example of 'CaptivePortal' crashed my ESP on connect #4222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
If I change the IP to the ESP default IP and uncomment the softApConfig then it does work on Android and Windows (at least seems to)
|
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions. |
Ow damm, do I need to write a bot again to keep a ticket open? |
[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future. |
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions. |
This issue seems to always occur om some ESP32, But not on others. Have not been able to prove this and such, but it might be some hardware version issue or so? |
[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future. |
In my case, the CaptivePortal code in the "DNSServer" lib works in Arduino IDE 1.8.13. However, when I create a project in VSCode with this code, the error reported by jellewie occurs. Task: Trying run the CaptivePortal code using VSCode System: Board: esp-wrover-kit Problem (only VSCode with PlatformIO) : Guru Meditation Error After uploading the code to ESP32 and trying to connect to the wifi network using a Android 8.0 smartphone Main.cpp: const byte DNS_PORT = 53; String responseHTML = "" Hello World!This is a captive portal example. All requests will " void setup() { WiFi.mode(WIFI_AP); // if DNSServer is started with "" for domain name, it will reply with server.begin(); void loop() { if (client) {
} PLATFORMIO.INI: ERROR MESSAGE: rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) Backtrace: 0x00000000:0x3ffb3b40 0x4011077e:0x3ffb3b80 0x4011d605:0x3ffb3ba0 0x4012260d:0x3ffb3be0 0x401278aa:0x3ffb3c00 0x40111187:0x3ffb3c20 0x400886e1:0x3ffb3c50 Rebooting... rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) |
Solved! I put a 2s delay to allow the softAP command to stabilize. |
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions. |
[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions. |
Still happens |
@zekageri tested on 2.0.4? |
framework is 2.0.4 yes. |
You may try updated Captive Portal example from DNSServerAsync lib. |
I will give it a try. Hope it works with Async we server by me_no_dev |
First try assert failed: tcp_update_rcv_ann_wnd IDF/components/lwip/lwip/src/core/tcp.c:951 (new_rcv_ann_wnd <= 0xffff)
Backtrace:0x40083cbd:0x3ffb55c00x4008ece5:0x3ffb55e0 0x40094509:0x3ffb5600 0x4011ba5e:0x3ffb5730 0x4011bb0c:0x3ffb5750 0x40186042:0x3ffb5770 0x40118398:0x3ffb5790
#0 0x40083cbd:0x3ffb55c0 in panic_abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/panic.c:402
#1 0x4008ece5:0x3ffb55e0 in esp_system_abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/esp_system.c:128
#2 0x40094509:0x3ffb5600 in __assert_func at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/newlib/assert.c:85
#3 0x4011ba5e:0x3ffb5730 in tcp_update_rcv_ann_wnd at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/lwip/lwip/src/core/tcp.c:951
(inlined by) tcp_update_rcv_ann_wnd at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/lwip/lwip/src/core/tcp.c:931
#4 0x4011bb0c:0x3ffb5750 in tcp_recved at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/lwip/lwip/src/core/tcp.c:991
#5 0x40186042:0x3ffb5770 in _tcp_recved_api(tcpip_api_call_data*) at lib/AsyncTCP/src/AsyncTCP.cpp:431
#6 0x40118398:0x3ffb5790 in tcpip_thread_handle_msg at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/lwip/lwip/src/api/tcpip.c:172
(inlined by) tcpip_thread at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/lwip/lwip/src/api/tcpip.c:154
ELF file SHA256: 0000000000000000
Rebooting... |
@zekageri are you sure you've build and example from DNSServerAsync? In your trace there is an AsyncTCP call. That example does not use AsyncTCP lib.
|
I had only this handler: captiveSerer.on("/", HTTP_GET, [this](AsyncWebServerRequest *request) {
AsyncWebServerResponse *response = request->beginResponse(
LittleFS,
WELCOME_PAGE_PATH,
sGlobal.getMimeType(WELCOME_PAGE_PATH)
);
request->send(response);
}); I added captiveSerer.on("/", HTTP_GET, [this](AsyncWebServerRequest *request) {
AsyncWebServerResponse *response = request->beginResponse(
LittleFS,
WELCOME_PAGE_PATH,
sGlobal.getMimeType(WELCOME_PAGE_PATH)
);
request->send(response);
});
captiveSerer.on("/portal", HTTP_GET, [this](AsyncWebServerRequest *request) {
AsyncWebServerResponse *response = request->beginResponse(
LittleFS,
WELCOME_PAGE_PATH,
sGlobal.getMimeType(WELCOME_PAGE_PATH)
);
request->send(response);
}); Will test it further. |
But i use it |
Maybe the crashes are all the Async TCP's fault? hmm CORRUPT HEAP: Bad head at 0x3ffd8780. Expected 0xabba1234 got 0x3ffcb0cc
assert failed: multi_heap_free multi_heap_poisoning.c:253 (head != NULL)
Backtrace:0x40083cbd:0x3ffb55b00x4008ece5:0x3ffb55d0 0x40094509:0x3ffb55f0 0x40094133:0x3ffb5720 0x40084151:0x3ffb5740 0x40094539:0x3ffb5760 0x40119ac7:0x3ffb5780 0x40119b23:0x3ffb57a0 0x40119b57:0x3ffb57c0 0x4011b571:0x3ffb57e0 0x4011c632:0x3ffb5800 0x4011c6d7:0x3ffb5830 0x401860ba:0x3ffb5850 0x40118334:0x3ffb5870
#0 0x40083cbd:0x3ffb55b0 in panic_abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/panic.c:402
#1 0x4008ece5:0x3ffb55d0 in esp_system_abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/esp_system.c:128
#2 0x40094509:0x3ffb55f0 in __assert_func at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/newlib/assert.c:85
#3 0x40094133:0x3ffb5720 in multi_heap_free at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/multi_heap_poisoning.c:253
(inlined by) multi_heap_free at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/multi_heap_poisoning.c:245
#4 0x40084151:0x3ffb5740 in heap_caps_free at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/heap_caps.c:340
#5 0x40094539:0x3ffb5760 in free at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/newlib/heap.c:39
#6 0x40119ac7:0x3ffb5780 in mem_free at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/lwip/lwip/src/core/mem.c:264 (discriminator 2)
#7 0x40119b23:0x3ffb57a0 in do_memp_free_pool at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/lwip/lwip/src/core/memp.c:383
#8 0x40119b57:0x3ffb57c0 in memp_free at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/lwip/lwip/src/core/memp.c:440
#9 0x4011b571:0x3ffb57e0 in tcp_free at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/lwip/lwip/src/core/tcp.c:216 (discriminator 2)
#10 0x4011c632:0x3ffb5800 in tcp_close_shutdown at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/lwip/lwip/src/core/tcp.c:370
#11 0x4011c6d7:0x3ffb5830 in tcp_close at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/lwip/lwip/src/core/tcp.c:498 (discriminator 1)
#12 0x401860ba:0x3ffb5850 in _tcp_close_api(tcpip_api_call_data*) at lib/AsyncTCP/src/AsyncTCP.cpp:452
#13 0x40118334:0x3ffb5870 in tcpip_thread_handle_msg at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/lwip/lwip/src/api/tcpip.c:172
(inlined by) tcpip_thread at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/lwip/lwip/src/api/tcpip.c:154
ELF file SHA256: 0000000000000000
Rebooting... |
So far the captive portal itself is working on android and windows. It pops up the webpage with Async Webserver too. And the crashes are much fewer than before. Will test it with IOS |
Looks like you have lot's of other things like littlefs and not sure what is |
Yes, i use LittleFS to serve webpages from the file system.
I use captive portal for first configuration. The user will post a config object with HTTP_POST. |
@zekageri I understand, but here discussing an issue with "CaptivePortal example" not "I have a project with async server, littlefs + something" and it fails. Pls, do not consider me being rude, just trying to narrow down the issue. Suspect that the root cause for an old example is that
so suppose it would not be a problem to stub it with |
@vortigont Thank you for the positive feedback. I appreciate. I understand that, but this issue only happens on captive portal and nowhere else in my code. I have literally hundreads of endpoints using this exact same model with Async webserver and littlefs and getMimeType and such things. I have an admin page where the page has a concurrent request more than 15. I know i have to narrow down the problem, but this is the narrowed down part. I suspect that the problem will be somewhere in lwip because most of the error's content are related to it in some way. If my code runs without captive portal it works in every imaginable mode. I'm also using ethernet and wifi and AP mode. In every case it is stable, except at captive portal connection. And this snippet is nowhere near the complexity of my any other frequently used endpoints. |
I tried the example on the latest version of Arduino-esp32 with ESP32 and an android phone and it works for me. |
Looks good to me so far. |
Hardware:
Board: DOIT ESP32 DEVKIT V1, default settings
Core Installation version: 1.0.4
IDE name: Arduino EDE 1.8.9
Flash Frequency: default settings
PSRAM enabled: default settings
Upload Speed: 921600
Computer OS: Windows 10
Description:
Example of CaptivePortal crashed the ESP
Steps to replicate
What I expected
That the example sketch does not crash when a device connects to it.
and that the DNS server will redirect you as it suppose to
Sketch:
arduino-esp32/libraries/DNSServer/examples/CaptivePortal/CaptivePortal.ino
Debug Messages:
Crash error
`rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5816
entry 0x400806ac
Guru Meditation Error: Core 0 panic'ed (InstrFetchProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x00000000 PS : 0x00060030 A0 : 0x8010feb1 A1 : 0x3ffb3b40
A2 : 0x3ffcc8a4 A3 : 0x3ffcbfe8 A4 : 0x3ffcb744 A5 : 0x3ffcb724
A6 : 0x0201a8c0 A7 : 0x0c01a8c0 A8 : 0x8010fd54 A9 : 0x3ffb3b00
A10 : 0x3ffcc8b4 A11 : 0x3ffcbfe8 A12 : 0x3ffb3b4c A13 : 0x00000044
A14 : 0x00000001 A15 : 0x00000006 SAR : 0x00000010 EXCCAUSE: 0x00000014
EXCVADDR: 0x00000000 LBEG : 0x4000c349 LEND : 0x4000c36b LCOUNT : 0x00000000
Backtrace: 0x00000000:0x3ffb3b40 0x4010feae:0x3ffb3b80 0x4011cd35:0x3ffb3ba0 0x40121d3d:0x3ffb3be0 0x40126fda:0x3ffb3c00 0x401108b7:0x3ffb3c20 0x400886e1:0x3ffb3c50`
=====DECODED
PC: 0x00000000
EXCVADDR: 0x00000000
Decoding stack results
0x4010feae: handle_dhcp at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/apps/dhcpserver/dhcpserver.c line 1031
0x4011cd35: udp_input at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/core/udp.c line 401
0x40121d3d: ip4_input at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/core/ipv4/ip4.c line 740
0x40126fda: ethernet_input at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/netif/ethernet.c line 184
0x401108b7: tcpip_thread at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/api/tcpip.c line 135
0x400886e1: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c line 143
The text was updated successfully, but these errors were encountered: