-
-
Notifications
You must be signed in to change notification settings - Fork 25
[BUG] Memory leak (lwip layer ?) when hit with SSL request (https://ip:80
) #172
Description
Description
Running PlatformIO with [email protected], mathieucarbou AsyncTCP and ESPAsyncWebServer. Custom settings:
-D CONFIG_ASYNC_TCP_PRIORITY=10
-D CONFIG_ASYNC_TCP_QUEUE_SIZE=256
-D CONFIG_ASYNC_TCP_STACK_SIZE=8192
-D CONFIG_ASYNC_TCP_RUNNING_CORE=1
When a request is made through HTTPS to the HTTP port, the web server (or AsyncTCP, perhaps) crashes fairly reliably, instead of just returning a request error. Sometimes it requires a few CTRL-F5 attempts for the core panic to occur.
Stack trace
Guru Meditation Error: Core 0 panic'ed (Load access fault). Exception was unhandled.
Core 0 register dump:
MEPC : 0x420d36b6 RA : 0x420d3718 SP : 0x3fca4450 GP : 0x3fc8e200
TP : 0x3fc74f78 T0 : 0x00000006 T1 : 0xe6baac4d T2 : 0x7201a8c0
S0/FP : 0x3fcb2d7c S1 : 0x3fcb2d7c A0 : 0x00000000 A1 : 0x3fcb2d7c
A2 : 0x00000000 A3 : 0x3fcb2888 A4 : 0x00000000 A5 : 0x420d3710
A6 : 0x00000000 A7 : 0x00000000 S2 : 0x3fc9a000 S3 : 0x3fc99386
S4 : 0x3fc99380 S5 : 0x3fc99390 S6 : 0x3fc9a000 S7 : 0x3fc99384
S8 : 0x3fc99388 S9 : 0x3fc94a38 S10 : 0x3fc993a6 S11 : 0x00000010
T3 : 0x00000000 T4 : 0x00000000 T5 : 0x3fcb2d7c T6 : 0x3fcb3cec
MSTATUS : 0x00001881 MTVEC : 0x40380001 MCAUSE : 0x00000005 MTVAL : 0x00000030
MHARTID : 0x00000000
Stack memory:
3fca4450: 0x3fc9a000 0x3fc9938c 0x3fcb2d7c 0x420d3718 0x3fc9a000 0x3fc9938c 0x3fcb2d7c 0x4205dac0
#0 0x3fc9938c in ?? at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/core/tcp_in.c:85
#1 0x420d3718 in AsyncServer::_s_accept(void*, tcp_pcb*, signed char) at lib/AsyncTCP/src/AsyncTCP.cpp:1591
#2 0x3fc9938c in ?? at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/core/tcp_in.c:85
#3 0x4205dac0 in tcp_process at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/core/tcp_in.c:947
(inlined by) tcp_input at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/core/tcp_in.c:438
3fca4470: 0x3fca4d6c 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
3fca4490: 0x00000000 0x00000000 0x3fcb2d7c 0x00000000 0x00000000 0x00000000 0x00000001 0x00000000
3fca44b0: 0x3fc9a000 0x00000014 0x3fca622c 0x3fca622c 0x3fcb27c8 0x3fc99ad8 0x3fcb4caa 0x42063776
#0 0x3fc99ad8 in ?? at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/core/ip.c:64
#1 0x42063776 in ip4_input at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/core/ipv4/ip4.c:804
3fca44d0: 0x00000004 0x00000003 0x00000000 0x00000000 0x00000004 0x00000003 0x3fcb2598 0x00000002
3fca44f0: 0x3fca622c 0x00000008 0x3fcb27c8 0x42067ee2 0x3fc99000 0xffffffff 0x3fcb4054 0x42056896
#0 0x42067ee2 in ethernet_input at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/netif/ethernet.c:253
#1 0x42056896 in tcpip_thread_handle_msg at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/api/tcpip.c:180
(inlined by) tcpip_thread at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/api/tcpip.c:154
3fca4510: 0x00000000 0x00000000 0x00000000 0x3fcb4054 0x00000000 0x00000000 0x00000000 0x00000000
3fca4530: 0x00000000 0x00000000 0x00000000 0x403897b4 0x00000000 0x00000000 0x00000000 0x00000000
#0 0x403897b4 in _prvTaskExitError at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port/riscv/port.c:126
(inlined by) prvTaskExitError at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port/riscv/port.c:140
3fca4550: 0x00000000 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xbaad5678
3fca4570: 0x00000160 0xabba1234 0x00000154 0x3fca43f0 0x00004c09 0x3fc95750 0x3fc95750 0x3fca457c
3fca4590: 0x3fc95748 0x00000007 0x3fca4d74 0x3fca4d74 0x3fca457c 0x00000000 0x00000012 0x3fca396c
3fca45b0: 0x00546974 0x00000000 0x40100000 0x001ca50c 0x00000000 0x3fca4560 0x00000012 0x00000000
3fca45d0: 0x00000000 0x00000000 0x00000000 0x3fc9a914 0x3fc9a97c 0x3fc9a9e4 0x00000000 0x00000000
3fca45f0: 0x00000001 0x00000000 0x00000000 0x00000000 0x420d49ae 0x00000000 0x00000000 0x00000000
#0 0x420d49ae in _cleanup_r at /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/newlib/libc/stdio/findfp.c:229
3fca4610: 0x3fcb3998 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
3fca4630: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
3fca4650: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
3fca4670: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
3fca4690: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
3fca46b0: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
3fca46d0: 0xbaad5678 0x000000e0 0xabba1234 0x000000d4 0x3fca4734 0x3fca4754 0x3fca47b4 0x3fca4750
3fca46f0: 0x00000000 0x3fca46f8 0xffffffff 0x3fca46f8 0x3fca46f8 0x00000001 0x3fca470c 0xffffffff
3fca4710: 0x3fca341c 0x3fca341c 0x00000000 0x00000020 0x00000004 0x0000ffff 0x00000000 0xb33fffff
3fca4730: 0x00000000 0x3fcacf88 0x3fcad688 0x3fcad010 0x3fcac674 0x3fcacd4c 0x3fcadd00 0x3fcae0f8
3fca4750: 0x3fcaea30 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5
3fca4770: 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5
3fca4790: 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5
3fca47b0: 0xa5a5a5a5 0xbaad5678 0x00000060 0xabba1234 0x00000054 0x00000000 0x3fca47c4 0x00000000
3fca47d0: 0x00000000 0x00000000 0x3fca47dc 0xffffffff 0x3fca47dc 0x3fca47dc 0x00000000 0x3fca47f0
3fca47f0: 0xffffffff 0x3fca47f0 0x3fca47f0 0x00000001 0x00000001 0x00000000 0x0000ffff 0x00000000
3fca4810: 0xb33fffff 0x00000000 0xbaad5678 0x00000018 0xabba1234 0x0000000c 0x00000000 0x3fca4844
3fca4830: 0x00000000 0xbaad5678 0x0000001c 0xabba1234 0x00000010 0x3c1002e4 0x3fca4eec 0x3fca38d0
How can I avoid this? Some of my users are using port forwarding with random port numbers, which results in problems if you just enter the web address without adding http:// explicitly since the browser attempts HTTPS first for non-standard ports. Apart from that, crashing because of such requests should never occur imho.