In our project ESP32 connects to a TCP server and stay connected sending some data and doing periodic keepalive.If connection is lost, ESP32 reconnects after 10 second. So far so good.
I have tested with http-request example (modified for my scope) and it works. I then copied the code in my project and the first connection is good with an allocated socket integer to 8192. When I simulate a lost of connection and ESP32 reconnects, the assigned socket integer number is 8193 (or above) and then it fails to connect reporting errno=104.
I have checked that the allocated socket number in http-request is around 4096-4104 and it works..could it be a problem of the integer number allocated to the socket?
If I delete the task with vTaskDelete and then create again with
Code: Select all
xTaskCreate(smm_task, "SmmTask", 8192, NULL, 10, &WIFI_SmmTask_Hndl);
Code: Select all
shutdown(socket, SHUT_RDWR);
close(socket);
I would like also to report a couple of crash I had during test:
1. Allocated socket integer was 8194
Code: Select all
Guru Meditation Error: Core 1 panic'ed (LoadProhibited)
. Exception was unhandled.
Core 1 register dump:
PC : 0x401750c9 PS : 0x00060230 A0 : 0x8016232d A1 : 0x3ffe5060
A2 : 0x0001364a A3 : 0x00000008 A4 : 0x3ffee05c A5 : 0x00000000
A6 : 0x00000000 A7 : 0x00060023 A8 : 0x80175315 A9 : 0x3ffe5040
A10 : 0x3ffc8d44 A11 : 0x00000000 A12 : 0x00000000 A13 : 0x00000000
A14 : 0x00060023 A15 : 0xff000000 SAR : 0x00000019 EXCCAUSE: 0x0000001c
EXCVADDR: 0x0001364a LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0xffffffff
Backtrace: 0x401750c9:0x3ffe5060 0x4016232a:0x3ffe5080 0x401641e5:0x3ffe50a0 0x4016ac0d:0x3ffe50c0 0x4016de02:0x3ffe50e0 0x40174366:0x3ffe5100 0x40164c19:0x3ffe5120
Entering gdb stub now.
$T0b#e6
xtensa-esp32-elf-gdb ./build/Avior_ESP32_WiFi.elf -b 115200 -ex 'target remote COM6'
GNU gdb (crosstool-NG crosstool-ng-1.22.0-80-g6c4433a5) 7.10
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-host_pc-mingw32 --target=xtensa-esp32-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./build/Avior_ESP32_WiFi.elf...done.
Remote debugging using COM6
0x401750c9 in sys_sem_signal (sem=0x1364a)
at C:/msys32/home/Davide/esp/esp-idf/components/lwip/port/freertos/sys_arch.c:133
133 xSemaphoreGive(*sem);
(gdb) bt
#0 0x401750c9 in sys_sem_signal (sem=0x1364a)
at C:/msys32/home/Davide/esp/esp-idf/components/lwip/port/freertos/sys_arch.c:133
#1 0x4016232d in event_callback (conn=<optimized out>, evt=<optimized out>,
len=<optimized out>)
at C:/msys32/home/Davide/esp/esp-idf/components/lwip/api/sockets.c:1922
#2 0x401641e8 in recv_tcp (arg=0x3ffec348, pcb=<optimized out>,
p=<optimized out>, err=<optimized out>)
at C:/msys32/home/Davide/esp/esp-idf/components/lwip/api/api_msg.c:303
#3 0x4016ac10 in tcp_input (p=<optimized out>, inp=<optimized out>)
at C:/msys32/home/Davide/esp/esp-idf/components/lwip/core/tcp_in.c:469
#4 0x4016de05 in ip4_input (p=0x3ffef2f8, inp=0x3ffec414)
at C:/msys32/home/Davide/esp/esp-idf/components/lwip/core/ipv4/ip4.c:711
#5 0x40174369 in ethernet_input (p=0x3ffef2f8, netif=0x3ffec414)
at C:/msys32/home/Davide/esp/esp-idf/components/lwip/netif/ethernet.c:176
#6 0x40164c1c in tcpip_thread (arg=<optimized out>)
at C:/msys32/home/Davide/esp/esp-idf/components/lwip/api/tcpip.c:143
Code: Select all
assertion "select_cb.prev == NULL" failed: file "C:/msys32/home/Davide/esp/esp-idf/components/lwip/api/sockets.c", line 1764, function: lwip_select
abort() was called at PC 0x400e88d3 on core 0
Backtrace: 0x400924d8:0x3ffedf20 0x4009267b:0x3ffedf40 0x400e88d3:0x3ffedf60 0x40162fca:0x3ffedf90 0x400e8509:0x3ffedff0
Entering gdb stub now.
$T0b#e6
xtensa-esp32-elf-gdb ./build/Avior_ESP32_WiFi.elf -b 115200 -ex 'target remote COM6'
GNU gdb (crosstool-NG crosstool-ng-1.22.0-80-g6c4433a5) 7.10
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-host_pc-mingw32 --target=xtensa-esp32-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./build/Avior_ESP32_WiFi.elf...done.
Remote debugging using COM6
0x400924d8 in invoke_abort ()
at C:/msys32/home/Davide/esp/esp-idf/components/esp32/panic.c:139
139 *((int *) 0) = 0;
(gdb) bt
#0 0x400924d8 in invoke_abort ()
at C:/msys32/home/Davide/esp/esp-idf/components/esp32/panic.c:139
#1 0x4009267e in abort ()
at C:/msys32/home/Davide/esp/esp-idf/components/esp32/panic.c:148
#2 0x400e88d6 in __assert_func (
file=0x3f429e60 "C:/msys32/home/Davide/esp/esp-idf/components/lwip/api/sockets.c", line=1764, func=<optim ized out>,
failedexpr=0x3f42a098 "select_cb.prev == NULL")
at ../../../.././newlib/libc/stdlib/assert.c:63
#3 0x40162fcd in lwip_select (
/builds/idf/crosstool-NG/.build/src/gdb-7.10/gdb/inline-frame.c:171: internal-error: inline_frame_this_id: As sertion `!frame_id_eq (*this_id, outer_frame_id)' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) [answered Y; input not from terminal]
This is a bug, please report it. For instructions, see:
<http://www.gnu.org/software/gdb/bugs/>.
/builds/idf/crosstool-NG/.build/src/gdb-7.10/gdb/inline-frame.c:171: internal-error: inline_frame_this_id: As sertion `!frame_id_eq (*this_id, outer_frame_id)' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) [answered Y; input not from terminal]
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.