homieiot / homie-esp8266

💡 ESP8266 framework for Homie, a lightweight MQTT convention for the IoT
http://homieiot.github.io/homie-esp8266
MIT License
1.36k stars 306 forks source link

Homie.prepareToSleep results in crash on ESP32 #683

Open qwandor opened 4 years ago

qwandor commented 4 years ago

Using the latest version from the develop branch, on an ESP32 with SSL enabled, I get the following crash a few seconds after calling Homie.prepareToSleep(), and never get a READY_TO_SLEEP event:

Offline message acknowledged. Disconnecting MQTT... assertion "pbuf_free: p->ref > 0" failed: file "/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/core/pbuf.c", line 765, function: pbuf_free

Backtrace: 0x4008d190:0x3ffd5720 0x4008d3c1:0x3ffd5740 0x401120c3:0x3ffd5760 0x4012b913:0x3ffd5790 0x401969c1:0x3ffd57b0 0x40196a99:0x3ffd5800 0x40196fd2:0x3ffd5820 0x400898a5:0x3ffd5850

0 0x4008d190:0x3ffd5720 in invoke_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c:707

1 0x4008d3c1:0x3ffd5740 in abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c:707

2 0x401120c3:0x3ffd5760 in __assert_func at /Users/ivan/e/newlib_xtensa-2.2.0-bin/newlib_xtensa-2.2.0/xtensa-esp32-elf/newlib/libc/stdlib/../../../.././newlib/libc/stdlib/assert.c:63 (discriminator 8)

3 0x4012b913:0x3ffd5790 in pbuf_free at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/core/pbuf.c:1331

4 0x401969c1:0x3ffd57b0 in AsyncClient::_recv(tcp_pcb, pbuf, signed char) at .pio/libdeps/m5stick-c/AsyncTCP/src/AsyncTCP.cpp:1246

5 0x40196a99:0x3ffd5800 in AsyncClient::_s_recv(void, tcp_pcb, pbuf*, signed char) at .pio/libdeps/m5stick-c/AsyncTCP/src/AsyncTCP.cpp:1246

6 0x40196fd2:0x3ffd5820 in _async_service_task(void*) at .pio/libdeps/m5stick-c/AsyncTCP/src/AsyncTCP.cpp:1246

  (inlined by) _async_service_task at .pio/libdeps/m5stick-c/AsyncTCP/src/AsyncTCP.cpp:202

7 0x400898a5:0x3ffd5850 in vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c:355 (discriminator 1)

Rebooting... ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) configsip: 188777542, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:2 load:0x3fff0018,len:4 load:0x3fff001c,len:1044 load:0x40078000,len:8896 load:0x40080400,len:5828 entry 0x400806ac

qwandor commented 4 years ago

This is on an M5Stick-C, in case it makes a difference.