AsyncTelegram2 icon indicating copy to clipboard operation
AsyncTelegram2 copied to clipboard

Core Panic after pressing button, resulting in boot looping

Open dannyz2 opened this issue 8 months ago • 4 comments

I loaded one of the examples(keyboardCallback.ino). It compiles fine, but complains of an issue on line 145 of AsyncTelegram2.cpp, easily remedied by adding a space before PRIu32. However, whether I add the space or not, whenever I press a button on the Telegram keyboard, I get a core panic.

You can see in this example, I let it run for 40 seconds, before pressing a button.(you can tell it ran the 40 seconds, because printHeapStats() is running every 10 seconds) Immediately after the button is pressed, I get a core panic, which results in a boot loop that can only be broken by re-loading the firmware (I assume because the unhandled message is still unhandled, but the message is causing the boot loop?)

How can this be fixed?

Added 3 buttons to keyboard Added 2 buttons to keyboard

Text message received: /inline_keyboard1

00:59:51 - Total free: 201108 - Max block: 110580 01:00:01 - Total free: 201108 - Max block: 110580 01:00:11 - Total free: 201108 - Max block: 110580 01:00:21 - Total free: 201108 - Max block: 110580Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.

Core 1 register dump: PC : 0x4008a524 PS : 0x00060b30 A0 : 0x8015ddc4 A1 : 0x3ffb19d0
A2 : 0x8892c33a A3 : 0x8892c338 A4 : 0x000000ff A5 : 0x0000ff00
A6 : 0x00ff0000 A7 : 0xff000000 A8 : 0x6469002e A9 : 0x3ffb1ea0
A10 : 0x3ffc3ce4 A11 : 0x3ffb2118 A12 : 0x00000000 A13 : 0x3ffc3d14
A14 : 0x3ffb20c0 A15 : 0x3ffb1f08 SAR : 0x0000001c EXCCAUSE: 0x0000001c
EXCVADDR: 0x8892c338 LBEG : 0x4008a539 LEND : 0x4008a549 LCOUNT : 0xffffffff

Backtrace: 0x4008a521:0x3ffb19d0 0x4015ddc1:0x3ffb19e0 0x4016292e:0x3ffb1cf0 0x4016296a:0x3ffb1d80 0x400dd072:0x3ffb1dc0 0x400d2def:0x3ffb1e60 0x400dc335:0x3ffb1e80 0x400db18b:0x3ffb1ea0 0x400d3347:0x3ffb20e0 0x400deecd:0x3ffb2290

ELF file SHA256: 965aa6c41777808c

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:2 load:0x3fff0030,len:1184 load:0x40078000,len:13232 load:0x40080400,len:3028 entry 0x400805e4

Test Telegram connection... OK Bot name: @TestingCTBot_bot Added 3 buttons to keyboard Added 2 buttons to keyboard Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.

dannyz2 avatar Apr 04 '25 23:04 dannyz2

I tried the same example using an ESP32C3, Still got the Panic, and following:

OK Bot name: @TestingCTBot_bot Added 3 buttons to keyboard Added 2 buttons to keyboard

06:40:04 - Total free: 178064 - Max block: 147444 Text message received: /inline_keyboard1

06:40:14 - Total free: 178064 - Max block: 147444 Text message received: /inline_keyboard1

06:40:24 - Total free: 178064 - Max block: 147444Guru Meditation Error: Core 0 panic'ed (Load access fault). Exception was unhandled.

Core 0 register dump: MEPC : 0x40058e94 RA : 0x4209b6de SP : 0x3fc9ebd0 GP : 0x3fc8e200
TP : 0x3fc7f9b0 T0 : 0x7fffffff T1 : 0x3fc9ec9c T2 : 0xffffffff
S0/FP : 0x00000000 S1 : 0x00000001 A0 : 0xe4dc266d A1 : 0x0000002a
A2 : 0x00000001 A3 : 0x3fc9f10c A4 : 0x00000001 A5 : 0xe4dc266d
A6 : 0x3fe00000 A7 : 0x00000000 S2 : 0xe4dc266d S3 : 0x3fc9f5e4
S4 : 0x3fc9f008 S5 : 0x00000009 S6 : 0x00000000 S7 : 0x00000000
S8 : 0x3c0b17cc S9 : 0x00000000 S10 : 0x3fc9eca4 S11 : 0xffffffff
T3 : 0xffffffff T4 : 0x00000278 T5 : 0x00001800 T6 : 0x3fc9f1b4
MSTATUS : 0x00001881 MTVEC : 0x40380001 MCAUSE : 0x00000005 MTVAL : 0xe4dc266d
MHARTID : 0x00000000

Stack memory: 3fc9ebd0: 0x3fc9ec68 0x00000073 0x00000000 0x3c0b17ce 0x3c0cda00 0x00000000 0x00000000 0x00000000 3fc9ebf0: 0x00000000 0x00000001 0x00000028 0x4205f8a8 0x00000000 0x3c0cb7b4 0x00000000 0x00000000 3fc9ec10: 0x00000000 0x00000000 0xffffffff 0x7fefffff 0x00000000 0x3fe00000 0xffff8e80 0x3fc97000 3fc9ec30: 0x00000000 0x3fc00000 0x00000000 0x40300000 0x00000010 0x3fc97000 0x3fcb6be0 0x4206114e 3fc9ec50: 0x0000099f 0x0000000c 0x3fcb6bf0 0x3fc9f10c 0xa038660b 0x95a5145b 0x00000000 0x00000000 3fc9ec70: 0x00000001 0x00000000 0x38220000 0x00000000 0x00000000 0x00000000 0x00000000 0x1f1a2d61 3fc9ec90: 0x3fc9ec9c 0x00000001 0x00000028 0x3c0b17a4 0x00000028 0x4203955a 0x3fc9ed08 0x18e660d4 3fc9ecb0: 0xaafc882d 0x81b9c89b 0x95a420ed 0x1f1a2d61 0x00006000 0xffffa000 0x3fc97000 0x3fcaade5 3fc9ecd0: 0x3fcaa368 0x3fc9ee30 0x00000000 0x420526ca 0x3fcaade5 0x3fcaade5 0x3fcaa228 0x3fcaaddd 3fc9ecf0: 0x00000000 0x3fc9ee30 0x00000000 0x42047e78 0x3fc9ed24 0x3fcab22c 0x00000010 0x00000000 3fc9ed10: 0x0000045f 0x00000000 0x3fca9b74 0x4202756a 0x00006000 0x00000447 0x0000000d 0x00000000 3fc9ed30: 0x11000000 0x04030317 0x00000047 0x4203635e 0xffffffff 0x00000005 0xffffffff 0x42023028 3fc9ed50: 0x00000000 0x00000000 0x3fc988a0 0x00000000 0x00006000 0xffffa000 0x00000000 0x0000045f 3fc9ed70: 0x00000000 0x0000045f 0x3fc91cb8 0x4202421c 0xffff8e80 0xffff9b80 0x3fc97000 0x3fca9b94 3fc9ed90: 0x0000002c 0x3fca9b68 0x0000003c 0x0000003c 0x3fca9b6c 0x3fcb6648 0x3fc97744 0x00000000 3fc9edb0: 0x00000000 0x00000000 0x00001800 0x00000075 0xe4dc266d 0x3fcaaa48 0x3fc97730 0x4038be40 3fc9edd0: 0x4205bf3c 0x42049d58 0x3fc9ee50 0x00000000 0x00000000 0x00000000 0x00001800 0x0000002d 3fc9edf0: 0x00000054 0x3fcaaa48 0x3fc97730 0x4038be40 0x3fc97e28 0x3fcaaa50 0x00000048 0xbaad5678 3fc9ee10: 0x3fc97730 0x3fcaaa50 0x00000036 0x4038bfcc 0x00001800 0x00000048 0x3fc8da4c 0x3fcaaa48 3fc9ee30: 0x3fc97e28 0x3fcaaa50 0x00000036 0x40382aa8 0x00000022 0x00000027 0x3fc99bf0 0x0000002d 3fc9ee50: 0x00001800 0x00000036 0x3fc8da4c 0x40382ad8 0x3fcaaa50 0x0000002d 0x3fc8da4c 0x420044d4 3fc9ee70: 0x3fcaaa50 0x3fc9f1a8 0x3fc9f0bc 0x4200499a 0x00000000 0x3fcaaa58 0x0000002d 0x00000000 3fc9ee90: 0x00000022 0x00000027 0x3fc99bf0 0x00000001 0x00000000 0x3fc99bf0 0x3fc9f0bc 0x420081e8 3fc9eeb0: 0x00000022 0x00000027 0x3fc99bf0 0x0000007d 0x00000001 0x00000000 0x3fc9f0bc 0x42008166 3fc9eed0: 0x3fcaaa3c 0x00000003 0x42008100 0x00000000 0x00000000 0x00000000 0x00001800 0x00000013 3fc9eef0: 0x00000034 0x3fcaaab8 0x3fc97730 0xc0380000 0x00000000 0x3fc97000 0xc0380000 0x0000002c 3fc9ef10: 0x3fc97730 0x00000000 0x3fc97730 0x4038bda8 0x00000000 0x3fc97000 0xc0380000 0xbaad5678 3fc9ef30: 0x3fc97730 0x00000000 0x00000028 0x4038bf42 0x00000028 0x3fc97e28 0x00001800 0x403828aa 3fc9ef50: 0x0000005c 0x00000022 0x3fc9f0bc 0x42006f08 0x00000022 0x00000027 0x3fc99c10 0x00000006 3fc9ef70: 0x00001800 0x00000028 0x00000000 0x00000000 0x00000000 0x3fcaab20 0x00000007 0x00000000 3fc9ef90: 0x00000022 0x00000027 0x3fc99c10 0x00000006 0x00000000 0x3fc99c10 0x3fc9f0bc 0x420081e8 3fc9efb0: 0x00000022 0x00000027 0x3fc99c10 0x0000007d 0x00000006 0x00000000 0x3fc9f0bc 0x00000000

ELF file SHA256: 6ef3c53c5efa5e8f

Rebooting... ESP-ROM:esp32c3-api1-20210207 Build:Feb 7 2021 rst:0x3 (RTC_SW_SYS_RST),boot:0xd (SPI_FAST_FLASH_BOOT) Saved PC:0x4038202c SPIWP:0xee mode:DIO, clock div:1 load:0x3fcd5810,len:0x438 load:0x403cc710,len:0x90c load:0x403ce710,len:0x2624 entry 0x403cc710 . Test Telegram connection... OK

dannyz2 avatar Apr 05 '25 04:04 dannyz2

And, an ESP WROOM 32D:

Test Telegram connection... OK Bot name: @TestingCTBot_bot Added 3 buttons to keyboard Added 2 buttons to keyboard Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.

Core 1 register dump: PC : 0x4008a524 PS : 0x00060b30 A0 : 0x8015ddc4 A1 : 0x3ffb19d0
A2 : 0xda53e24e A3 : 0xda53e24c A4 : 0x000000ff A5 : 0x0000ff00
A6 : 0x00ff0000 A7 : 0xff000000 A8 : 0x6469002e A9 : 0x3ffb1ea0
A10 : 0x3ffc3ce4 A11 : 0x3ffb2118 A12 : 0x00000001 A13 : 0x3ffc3d18
A14 : 0x3ffb20c0 A15 : 0x3ffb1f08 SAR : 0x00000020 EXCCAUSE: 0x0000001c
EXCVADDR: 0xda53e24c LBEG : 0x4008a539 LEND : 0x4008a549 LCOUNT : 0xffffffff

Backtrace: 0x4008a521:0x3ffb19d0 0x4015ddc1:0x3ffb19e0 0x4016292e:0x3ffb1cf0 0x4016296a:0x3ffb1d80 0x400dd072:0x3ffb1dc0 0x400d2e63:0x3ffb1e60 0x400dc335:0x3ffb1e80 0x400db18b:0x3ffb1ea0 0x400d3347:0x3ffb20e0 0x400deecd:0x3ffb2290

ELF file SHA256: 4986da13deafc224

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:2 load:0x3fff0030,len:1184 load:0x40078000,len:13232 load:0x40080400,len:3028 entry 0x400805e4

Test Telegram connection... OK Bot name: @TestingCTBot_bot Added 3 buttons to keyboard Added 2 buttons to keyboard Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.

dannyz2 avatar Apr 05 '25 05:04 dannyz2

Hi @dannyz2, and thanks for pointing out this bug. I believe the issue is due to the wrong data type being used in the callback functions.

In the example, there's this line: Serial.printf("\nON button pressed (callback);\nQueryId: %s\n\n", queryMsg.callbackQueryID);

But queryMsg.callbackQueryID is an int64, not a C string. It's been a while since I last compiled these examples, and most likely, the latest updates to the ESP32 core for Arduino are (rightfully) much less forgiving with this kind of mistake, causing the crash.

I just committed the corrected example, and on my system it works without causing any errors. If you want, give it a try and let me know.

cotestatnt avatar Apr 05 '25 09:04 cotestatnt

Yes, that seems to have fixed the issue, Just very basic testing, no time right now to test properly, we had an emergency come up, and have to fly back home tomorrow. Super busy getting everything ready for us to leave. Will update after more testing, in a few days. Thanks VERY much, that was a fast response!

dannyz2 avatar Apr 06 '25 06:04 dannyz2

Works AWESOME!!, thanks. Had a minor issue with boot looping if I sent a re-boot command, but, got that fixed, all seems to be working well.

dannyz2 avatar Apr 25 '25 01:04 dannyz2