Page 1 of 1

ESP32 Mqtt重连问题

Posted: Thu Aug 01, 2024 1:20 am
by suki1213
使用的是esp32c3模块 idf版本是5.2.1
出现该bug的原因是公司全体断网了, 来网的时候esp尝试重连mqtt但是此时mqtt还没有上线
日志如下:
17:44:30.235457 E (29541157) mqtt_client: No PING_RESP, disconnected
17:44:30.236458 I (29541157) wifi_app: uart_send_task delete!
17:44:30.240458 MQTT_client have disconnected.
17:44:45.227345 Other event id:7
17:44:52.241050 E (29563157) esp-tls: couldn't get hostname for :iot-040adgs9.mqtt.iothub.aliyuncs.com: getaddrinfo() returns 202, addrinfo=0x0
17:44:52.246051 E (29563157) transport_base: Failed to open a new connection: 32769
17:44:52.252050 E (29563157) mqtt_client: Error transport connect
17:44:52.253050 MQTT_EVENT_ERROR
17:44:52.300271 Guru Meditation Error: Core 0 panic'ed (Load access fault). Exception was unhandled.
17:44:52.301273
17:44:52.301273 Core 0 register dump:
17:44:52.311273 MEPC : 0x4038982a RA : 0x403881aa SP : 0x3fcb9f20 GP : 0x3fc91a00
17:44:52.539915 0x4038982a: uxListRemove at D:/Espressif/frameworks/esp-idf-v5.1.2/components/freertos/FreeRTOS-Kernel/list.c:204
17:44:52.539915 0x403881aa: vTaskDelete at D:/Espressif/frameworks/esp-idf-v5.1.2/components/freertos/FreeRTOS-Kernel/tasks.c:1434 (discriminator 4)

17:44:52.550913 TP : 0x3fc89490 T0 : 0x3fcb1220 T1 : 0x3fcaf611 T2 : 0x00000002
17:44:52.551914 S0/FP : 0x3fcb0e08 S1 : 0x3fcb1220 A0 : 0x3fcb0e0c A1 : 0x00000002
17:44:52.552914 A2 : 0x00000002 A3 : 0x3fc93fa0 A4 : 0x3fc9fa2c A5 : 0x00000000
17:44:52.552914 A6 : 0x4200a38a A7 : 0x00000047 S2 : 0x3fcb0e0c S3 : 0x002d1bec
17:44:52.567913 0x4200a38a: mqtt_event_handler at D:/Code/STA1_ota/main/main.c:252

17:44:52.571914 S4 : 0x00000000 S5 : 0x00000000 S6 : 0x00000000 S7 : 0x00000000
17:44:52.572915 S8 : 0x00000000 S9 : 0x00000000 S10 : 0x00000000 S11 : 0x00000000
17:44:52.573915 T3 : 0x00000000 T4 : 0x0000006b T5 : 0x0000006b T6 : 0x3fcaf658
17:44:52.574914 MSTATUS : 0x00001881 MTVEC : 0x40380001 MCAUSE : 0x00000005 MTVAL : 0x00000004
17:44:52.593914 0x40380001: _vector_table at ??:?

17:44:52.595914 MHARTID : 0x00000000
17:44:52.595914
17:44:52.596914 Stack memory:
17:44:52.596914 3fcb9f20: 0x00000000 0x3fcb1220 0x3fcaef80 0x4200a3ca 0x3fcb9fbc 0x00000000 0x3fcac24c 0x40387818
17:44:52.624480 0x4200a3ca: mqtt_event_handler at D:/Code/STA1_ota/main/main.c:278
17:44:52.624480 0x40387818: xQueueSemaphoreTake at D:/Espressif/frameworks/esp-idf-v5.1.2/components/freertos/FreeRTOS-Kernel/queue.c:1721

17:44:52.628480 3fcb9f40: 0x00000000 0x00000000 0x3fcac24c 0xffffffff 0x00000000 0x00000000 0x00000000 0x002d1bec
17:44:52.628480 3fcb9f60: 0x00000000 0x3fcab8a0 0x3fc9bdc0 0x420ce4e6 0x00000000 0x3fcab8a0 0x3fcb1220 0x420ced1e
17:44:52.657480 0x420ce4e6: handler_execute at D:/Espressif/frameworks/esp-idf-v5.1.2/components/esp_event/esp_event.c:163
17:44:52.657480 0x420ced1e: esp_event_loop_run at D:/Espressif/frameworks/esp-idf-v5.1.2/components/esp_event/esp_event.c:592 (discriminator 3)

17:44:52.663480 3fcb9f80: 0x00000101 0x3c0e7ba8 0x00000002 0x3fcaef80 0x00000101 0x3c0e7ba8 0x00000002 0x3fcaef80
17:44:52.663480 3fcb9fa0: 0x00000101 0x3c0e7ba8 0x00000000 0x00000000 0x00000000 0x00000000 0x00000001 0x3fcab7e8
17:44:52.664480 3fcb9fc0: 0x00000000 0x01c2c326 0x3fcb1220 0x4200dce0 0x00000000 0x3fcafc84 0x0x4200dce0: esp_mqtt_dispatch_event at D:/Espressif/frameworks/esp-idf-v5.1.2/components/mqtt/esp-mqtt/mqtt_client.c:1024

17:44:52.680480 3fcb1220 0x4200e2e4
17:44:52.694481 0x4200e2e4: esp_mqtt_dispatch_event_with_msgid at D:/Espressif/frameworks/esp-idf-v5.1.2/components/mqtt/esp-mqtt/mqtt_client.c:992

17:44:52.697479 3fcb9fe0: 0x00000000 0x01c2c326 0x3fcb1220 0x4200e3f6 0x3c0e79b4 0x01c2c326 0x3fcb1220 0x4200f3ec
17:44:52.723480 0x4200e3f6: esp_mqtt_abort_connection at D:/Espressif/frameworks/esp-idf-v5.1.2/components/mqtt/esp-mqtt/mqtt_client.c:799
17:44:52.723480 0x4200f3ec: esp_mqtt_task at D:/Espressif/frameworks/esp-idf-v5.1.2/components/mqtt/esp-mqtt/mqtt_client.c:1600 (discriminator 3)

17:44:52.729479 3fcba000: 0x00000000 0x00000000 0x0060d4ea 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
17:44:52.729479 3fcba020: 0x00000000 0x00000000 0x00000000 0x40389302 0x00000000 0x00000000 0x00000000 0x00000000
17:44:52.741481 0x40389302: vPortTaskWrapper at D:/Espressif/frameworks/esp-idf-v5.1.2/components/freertos/FreeRTOS-Kernel/portable/riscv/port.c:205

17:44:52.745480 3fcba040: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5
17:44:52.746480 3fcba060: 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0x00005f8d 0x3fc99c34 0x3fc99c34 0x3fcba0a0 0x00000001
17:44:52.746480 3fcba080: 0x3fcba0d0 0x003e0018 0x00070000 0x00000000 0x00000000 0x3fcaeef4 0x00000000 0x3fcba0ac
17:44:52.747479 3fcba0a0: 0x00088640 0x3fcba0d0 0x00000000 0x00000100 0xe1974c4e 0x00000006 0x00000000 0x00000000
17:44:52.747479 3fcba0c0: 0x00000000 0x00000000 0x00000000 0x00000000 0x10640bd2 0x00000000 0x93060000 0xe1974c4e
17:44:52.747479 3fcba0e0: 0x940fabea 0x28d3d2a4 0x3b09c136 0x75300000 0x00000000 0x00000000 0x00000000 0x0005c064
17:44:52.748479 3fcba100: 0x00004208 0x00003333 0x81480200 0xfce96ad4 0x60f654f8 0xfbe062da 0x333389cf 0x02000000
17:44:52.748479 3fcba120: 0x60f654f8 0xdd8662da 0x00000060 0xff3a0800 0x000080fe 0x00000000 0x195d21ed 0xc79d5ddc
17:44:52.749479 3fcba140: 0x000002ff 0x00000000 0x00000000 0x02000000 0xd6b80085 0x00000000 0x000080fe 0x00000000
17:44:52.749479 3fcba160: 0x611ae2ba 0xbdbfff5e 0x23400102 0xf5b59543 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5
17:44:52.750479 3fcba180: 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5
17:44:52.750479 3fcba1a0: 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5
17:44:52.751480 3fcba1c0: 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5
17:44:52.752480 3fcba1e0: 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5
17:44:52.753479 3fcba200: 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5
17:44:52.753479 3fcba220: 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5
17:44:52.754480 3fcba240: 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5
17:44:52.754480 3fcba260: 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5
17:44:52.755479 3fcba280: 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5
17:44:52.755479 3fcba2a0: 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5
17:44:52.755479 3fcba2c0: 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5
17:44:52.756479 3fcba2e0: 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5
17:44:52.756479 3fcba300: 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5
17:44:52.756479
17:44:52.756479
17:44:52.757479
17:44:52.757479 ELF file SHA256: 161cace083aab4de
17:44:52.824479
17:44:52.824479 Rebooting...
17:44:52.825480 ESP-ROM:esp32c3-api1-20210207
17:44:52.825480 Build:Feb 7 2021
17:44:52.825480 rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
17:44:52.825480 Saved PC:0x40048b82
17:44:52.865843 0x40048b82: ets_secure_boot_verify_bootloader_with_keys in ROM
如何解决这种情况 或者如何知道运行到哪里崩溃的