Example adafruitio_11_group_pub causes crash on Huzzah32
zencow opened this issue · 6 comments
Hi...
I attempted troubleshooting on the discord server about this, but upon looking further, I found that the error applies to the stock example as well as my more complex and messy code. ;)
I used a plain Huzzah32 Feather connected only to an Adafruit Lipo and the USB connection to my computer for programming with the Arduino tools.
-
Arduino board: Adafruit HUZZAH32 – ESP32 Feather Board
https://www.adafruit.com/product/3405 -
Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.12
-
List the steps to reproduce the problem below (if possible attach a sketch or
copy the sketch code in too):
- loaded stock example 11 from Adafruit IO Arduino version 3.4.0
- The only changes I made are the 4 lines required in config.h for my AIO and WIFI credentials.
- The code compiles and programs successfully, then runs until after the first set of data is published, then crashes a few seconds later.
Serial output:
19:24:10.779 -> ets Jun 8 2016 00:22:57
19:24:10.779 ->
19:24:10.779 -> rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
19:24:10.779 -> configsip: 0, SPIWP:0xee
19:24:10.779 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
19:24:10.779 -> mode:DIO, clock div:1
19:24:10.779 -> load:0x3fff0018,len:4
19:24:10.779 -> load:0x3fff001c,len:1044
19:24:10.779 -> load:0x40078000,len:8896
19:24:10.779 -> load:0x40080400,len:5816
19:24:10.779 -> entry 0x400806ac
19:24:11.076 -> Connecting to Adafruit IO.
19:24:14.002 -> Adafruit IO connected.
19:24:14.118 -> sending example.count-1 -> 0
19:24:14.118 -> sending example.count-2 -> 0
19:24:18.158 -> Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
19:24:18.158 -> Core 1 register dump:
19:24:18.158 -> PC : 0x400d1e80 PS : 0x00060830 A0 : 0x800d1f28 A1 : 0x3ffb1ee0
19:24:18.158 -> A2 : 0xfefefefe A3 : 0x3ffd6610 A4 : 0x00000000 A5 : 0x00000000
19:24:18.158 -> A6 : 0x00000000 A7 : 0x00000000 A8 : 0x800d1cdc A9 : 0x3ffb1eb0
19:24:18.158 -> A10 : 0x3ffd6610 A11 : 0x7fffffff A12 : 0x00000000 A13 : 0x00000000
19:24:18.158 -> A14 : 0x00000000 A15 : 0x00000000 SAR : 0x0000000a EXCCAUSE: 0x0000001c
19:24:18.211 -> EXCVADDR: 0xfefefefe LBEG : 0x400012c5 LEND : 0x400012d5 LCOUNT : 0xfffffff7
19:24:18.211 ->
19:24:18.211 -> Backtrace: 0x400d1e80:0x3ffb1ee0 0x400d1f25:0x3ffb1f00 0x400d25e4:0x3ffb1f50 0x400d1b6f:0x3ffb1f70 0x400d17fe:0x3ffb1f90 0x400d5145:0x3ffb1fb0 0x40088b9d:0x3ffb1fd0
19:24:18.211 ->
19:24:18.211 -> Rebooting...
Decoded panic data:
PC: 0x400d1e80: AdafruitIO_Group::call(AdafruitIO_Data*) at C:\Users\chris\Documents\Arduino\libraries\Adafruit_IO_Arduino\src\AdafruitIO_Group.cpp line 348
EXCVADDR: 0xfefefefe
Decoding stack results
0x400d1e80: AdafruitIO_Group::call(AdafruitIO_Data*) at C:\Users\chris\Documents\Arduino\libraries\Adafruit_IO_Arduino\src\AdafruitIO_Group.cpp line 348
0x400d1f25: AdafruitIO_Group::subCallback(char*, unsigned short) at C:\Users\chris\Documents\Arduino\libraries\Adafruit_IO_Arduino\src\AdafruitIO_Group.cpp line 399
0x400d25e4: Adafruit_MQTT::processPackets(short) at C:\Users\chris\Documents\Arduino\libraries\Adafruit_MQTT_Library\Adafruit_MQTT.cpp line 443
0x400d1b6f: AdafruitIO::run(unsigned short, bool) at C:\Users\chris\Documents\Arduino\libraries\Adafruit_IO_Arduino\src\AdafruitIO.cpp line 340
0x400d17fe: loop() at C:\Users\chris\Documents\Arduino\adafruitio_11_group_pub/adafruitio_11_group_pub.ino line 58
0x400d5145: loopTask(void*) at C:\Users\chris\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\cores\esp32\main.cpp line 19
0x40088b9d: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c line 143
Note: I noticed there's another issue open for example 12 ("group sub", which is the complimentary example to this one which is the "group pub" example): #111
It should be worth noting that the Group and Feeds were created automatically and a "0" was published for each Feed on each reboot of the device. The program always crashed during the 2nd call to io.run() before it got the chance to publish any incremented values.
Second stack trace for crash/reset on group publishing, from the Adafruit IO Forum: https://forums.adafruit.com/viewtopic.php?f=56&t=164450
Same error on HUZZAH32 w/example group sub and group pub:
Adafruit IO connected.
sending example.count-1 -> 0
sending example.count-2 -> 0
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x400d2308 PS : 0x00060830 A0 : 0x800d23b0 A1 : 0x3ffb1ee0
A2 : 0xfefefefe A3 : 0x3ffcc73c A4 : 0x00000000 A5 : 0x00000000
A6 : 0x00000000 A7 : 0x00000000 A8 : 0x800d2164 A9 : 0x3ffb1eb0
A10 : 0x3ffcc73c A11 : 0x7fffffff A12 : 0x00000000 A13 : 0x00000000
A14 : 0x00000000 A15 : 0x00000000 SAR : 0x0000000a EXCCAUSE: 0x0000001c
EXCVADDR: 0xfefefefe LBEG : 0x400012c5 LEND : 0x400012d5 LCOUNT : 0xfffffff7
Backtrace: 0x400d2308:0x3ffb1ee0 0x400d23ad:0x3ffb1f00 0x400d2a3c:0x3ffb1f50 0x400d1ffa:0x3ffb1f70 0x400d1cf0:0x3ffb1f90 0x400d5d49:0x3ffb1fb0 0x400883ed:0x3ffb1fd0
Rebooting...
ets Jun 8 2016 00:22:57
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:928
ho 0 tail 12 room 4
load:0x40078000,len:8740
load:0x40080400,len:5788
entry 0x4008069c
Connecting to Adafruit IO............
decoded stack trace
PC: 0x400d2308
EXCVADDR: 0xfefefefe
Decoding stack results
0x400d2308: AdafruitIO_Group::call(AdafruitIO_Data*) at /Users/brentrubell/Documents/Arduino/libraries/Adafruit_IO_Arduino/src/AdafruitIO_Group.cpp line 230
0x400d23ad: AdafruitIO_Group::subCallback(char*, unsigned short) at /Users/brentrubell/Documents/Arduino/libraries/Adafruit_IO_Arduino/src/AdafruitIO_Group.cpp line 275
0x400d2a3c: Adafruit_MQTT::processPackets(short) at /Users/brentrubell/Documents/Arduino/libraries/Adafruit_MQTT_Library/Adafruit_MQTT.cpp line 443
0x400d1ffa: AdafruitIO::run(unsigned short) at /Users/brentrubell/Documents/Arduino/libraries/Adafruit_IO_Arduino/src/AdafruitIO.cpp line 184
0x400d1cf0: loop() at /Users/brentrubell/Documents/Arduino/adafruitio_11_group_pub/adafruitio_11_group_pub.ino line 58
0x400d5d49: loopTask(void*) at /Users/brentrubell/Library/Arduino15/packages/esp32/hardware/esp32/1.0.3/cores/esp32/main.cpp line 19
0x400883ed: vPortTaskWrapper at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/freertos/port.c line 143
@zencow This is the same error as #111 and I didn't understand why this was crashing until I looked at the group subscription sketch closely.
The comparison if (strcmp(cur_cb->feed, d->feedName()) == 0 || cur_cb->feed == NULL{
fails due to the callback attempting to obtain the feed's name (cur_cb->feed
) because the _groupCallback
callback was never properly init'd since the setup()
in adafruitio_11_group_pub.ino
never calls onMessage, which is used to initialize the _groupCallback
(https://github.com/adafruit/Adafruit_IO_Arduino/blob/master/src/AdafruitIO_Group.cpp#L309).
Also, _groupCallback
is never NULL
, so the check within onMessage
which initialzes _groupCallback
also fails. This is why the subscribe example fails in the same part of the code, while it properly sets up the message handler.
I'll create a PR for this today.
I tested the patch at "Fix ESP32 Groups Crash #115" and it worked for me. No more crashes.
I got the latest library update (v 3.5.0) from the Arduino IDE and it ran 10 cycles before I killed it. ;) Kudos!