Closed Gyunamchoi closed 2 weeks ago
Hello @Gyunamchoi,
Thank you for bringing up the issue.
Could you please print the free heap memory before the function fails? Alternatively, if possible, could you create a small working example to reproduce the issue or integrate it into one of the existing IDF examples?
Hello @nileshkale123
Could you wait for 2~3days? I will summarize and deliver the following responses.
2-1) However, since it is a problem that occurs when connecting to the aws iot core service and creating an ota job, I wonder if the environment is suitable for testing the aws iot core 2-2) I will deliver the job creation process in the aws iot service later when uploading the code or heap data.
Thank you for your response.
Hello @nileshkale123
This is all heap data just before the problem occurred.
Showing data for heap: 0x3ffae6e0 Block 0x3ffae860 data, size: 184 bytes, Free: No Block 0x3ffae91c data, size: 12 bytes, Free: No Block 0x3ffae92c data, size: 12 bytes, Free: No Block 0x3ffae93c data, size: 16 bytes, Free: No Block 0x3ffae950 data, size: 196 bytes, Free: No Block 0x3ffaea18 data, size: 196 bytes, Free: No Block 0x3ffaeae0 data, size: 432 bytes, Free: No Block 0x3ffaec94 data, size: 88 bytes, Free: No Block 0x3ffaecf0 data, size: 88 bytes, Free: No Block 0x3ffaed4c data, size: 88 bytes, Free: No Block 0x3ffaeda8 data, size: 132 bytes, Free: No Block 0x3ffaee30 data, size: 132 bytes, Free: No Block 0x3ffaeeb8 data, size: 16 bytes, Free: No Block 0x3ffaeecc data, size: 88 bytes, Free: No Block 0x3ffaef28 data, size: 88 bytes, Free: No Block 0x3ffaef84 data, size: 16 bytes, Free: No Block 0x3ffaef98 data, size: 12 bytes, Free: No Block 0x3ffaefa8 data, size: 88 bytes, Free: No Block 0x3ffaf004 data, size: 1028 bytes, Free: No Block 0x3ffaf40c data, size: 344 bytes, Free: No Block 0x3ffaf568 data, size: 1028 bytes, Free: No Block 0x3ffaf970 data, size: 344 bytes, Free: No Block 0x3ffafacc data, size: 344 bytes, Free: No Block 0x3ffafc28 data, size: 12 bytes, Free: No Block 0x3ffafc38 data, size: 16 bytes, Free: No Block 0x3ffafc4c data, size: 12 bytes, Free: No Block 0x3ffafc5c data, size: 16 bytes, Free: No Block 0x3ffafc70 data, size: 344 bytes, Free: No Block 0x3ffafdcc data, size: 344 bytes, Free: No Block 0x3ffaff28 data, size: 88 bytes, Free: No Block 0x3ffaff84 data, size: 16 bytes, Free: No Block 0x3ffaff98 data, size: 100 bytes, Free: No Showing data for heap: 0x3ffb55e0 Block 0x3ffb5990 data, size: 4100 bytes, Free: No Block 0x3ffb6998 data, size: 4100 bytes, Free: No Block 0x3ffb79a0 data, size: 1540 bytes, Free: No Block 0x3ffb7fa8 data, size: 1540 bytes, Free: No Block 0x3ffb85b0 data, size: 344 bytes, Free: No Block 0x3ffb870c data, size: 20 bytes, Free: No Block 0x3ffb8724 data, size: 16 bytes, Free: No Block 0x3ffb8738 data, size: 20 bytes, Free: No Block 0x3ffb8750 data, size: 20 bytes, Free: No Block 0x3ffb8768 data, size: 28 bytes, Free: No Block 0x3ffb8788 data, size: 600 bytes, Free: No Block 0x3ffb89e4 data, size: 88 bytes, Free: No Block 0x3ffb8a40 data, size: 2820 bytes, Free: No Block 0x3ffb9548 data, size: 344 bytes, Free: No Block 0x3ffb96a4 data, size: 88 bytes, Free: No Block 0x3ffb9700 data, size: 44 bytes, Free: No Block 0x3ffb9730 data, size: 88 bytes, Free: No Block 0x3ffb978c data, size: 48 bytes, Free: No Block 0x3ffb97c0 data, size: 48 bytes, Free: No Block 0x3ffb97f4 data, size: 20 bytes, Free: No Block 0x3ffb980c data, size: 24 bytes, Free: No Block 0x3ffb9828 data, size: 56 bytes, Free: No Block 0x3ffb9864 data, size: 56 bytes, Free: No Block 0x3ffb98a0 data, size: 56 bytes, Free: No Block 0x3ffb98dc data, size: 56 bytes, Free: No Block 0x3ffb9918 data, size: 56 bytes, Free: No Block 0x3ffb9954 data, size: 56 bytes, Free: No Block 0x3ffb9990 data, size: 108 bytes, Free: No Block 0x3ffb9a00 data, size: 344 bytes, Free: No Block 0x3ffb9b5c data, size: 132 bytes, Free: No Block 0x3ffb9be4 data, size: 132 bytes, Free: No Block 0x3ffb9c6c data, size: 132 bytes, Free: No Block 0x3ffb9cf4 data, size: 32 bytes, Free: No Block 0x3ffb9d18 data, size: 32 bytes, Free: No Block 0x3ffb9d3c data, size: 88 bytes, Free: No Block 0x3ffb9d98 data, size: 40 bytes, Free: No Block 0x3ffb9dc4 data, size: 20 bytes, Free: No Block 0x3ffb9ddc data, size: 12 bytes, Free: No Block 0x3ffb9dec data, size: 12 bytes, Free: No Block 0x3ffb9dfc data, size: 20 bytes, Free: No Block 0x3ffb9e14 data, size: 12 bytes, Free: No Block 0x3ffb9e24 data, size: 12 bytes, Free: No Block 0x3ffb9e34 data, size: 88 bytes, Free: No Block 0x3ffb9e90 data, size: 88 bytes, Free: No Block 0x3ffb9eec data, size: 16 bytes, Free: No Block 0x3ffb9f00 data, size: 196 bytes, Free: No Block 0x3ffb9fc8 data, size: 88 bytes, Free: No Block 0x3ffba024 data, size: 20 bytes, Free: No Block 0x3ffba03c data, size: 20 bytes, Free: No Block 0x3ffba054 data, size: 20 bytes, Free: No Block 0x3ffba06c data, size: 12 bytes, Free: No Block 0x3ffba07c data, size: 216 bytes, Free: No Block 0x3ffba158 data, size: 3588 bytes, Free: No Block 0x3ffbaf60 data, size: 344 bytes, Free: No Block 0x3ffbb0bc data, size: 88 bytes, Free: No Block 0x3ffbb118 data, size: 104 bytes, Free: No Block 0x3ffbb184 data, size: 16 bytes, Free: No Block 0x3ffbb198 data, size: 16 bytes, Free: No Block 0x3ffbb1ac data, size: 260 bytes, Free: No Block 0x3ffbb2b4 data, size: 12 bytes, Free: No Block 0x3ffbb2c4 data, size: 12 bytes, Free: No Block 0x3ffbb2d4 data, size: 12 bytes, Free: No Block 0x3ffbb2e4 data, size: 20 bytes, Free: No Block 0x3ffbb2fc data, size: 100 bytes, Free: No Block 0x3ffbb364 data, size: 468 bytes, Free: No Block 0x3ffbb53c data, size: 24 bytes, Free: No Block 0x3ffbb558 data, size: 56 bytes, Free: No Block 0x3ffbb594 data, size: 128 bytes,Guru Meditation Error: Core 0 panic'ed (Interrupt wdt timeout on CPU0).
This is the error message from the part where the error occurred.
`Guru Meditation Error: Core 0 panic'ed (Interrupt wdt timeout on CPU0).
Core 0 register dump:
PC : 0x4000921f PS : 0x00060a34 A0 : 0x80007d16 A1 : 0x3ffc4210
0x4000921f: uart_tx_one_char in ROM
A2 : 0xeb80c00f A3 : 0x10000000 A4 : 0x00000000 A5 : 0x00060a23
A6 : 0x00000001 A7 : 0x3ffb9e94 A8 : 0x3ff40000 A9 : 0x00000020
A10 : 0x00800000 A11 : 0x3ff4001c A12 : 0x00000000 A13 : 0x00060a23
A14 : 0x80000000 A15 : 0x3ffae888 SAR : 0x00000004 EXCCAUSE: 0x00000005
EXCVADDR: 0x00000000 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0x00000000
0x4000c2e0: memcpy in ROM
0x4000c2f6: memcpy in ROM
Backtrace: 0x4000921c:0x3ffc4210 0x40007d13:0x3ffc4230 0x40007c69:0x3ffc4250 0x40008148:0x3ffc4270 0x40148c49:0x3ffc4300 0x40148f47:0x3ffc4320 0x40148cd9:0x3ffc4340 0x400d49ab:0x3ffc4360 0x400d49be:0x3ffc4380 0x400dc541:0x3ffc43a0 0x400dcd85:0x3ffc47d0 0x400dd0ed:0x3ffc47f0 0x40147fb9:0x3ffc4890 0x40147a4e:0x3ffc48c0 0x400e53ba:0x3ffc4900 0x400e5e1c:0x3ffc4920 0x400e5f83:0x3ffc4950 0x400e6480:0x3ffc4980 0x400883f9:0x3ffc49b0 0x4000921c: uart_tx_one_char in ROM 0x40007d13: ets_write_char_uart in ROM 0x40007c69: ets_write_char in ROM 0x40008148: ets_printf in ROM 0x40148c49: multi_heap_dump_tlsf at /Users/odn/esp/esp-idf/components/heap/multi_heap.c:361 (discriminator 4) 0x40148f47: tlsf_walk_pool at /Users/odn/esp/esp-idf/components/heap/tlsf/tlsf.c:771 0x40148cd9: multi_heap_dump at /Users/odn/esp/esp-idf/components/heap/multi_heap.c:371 (discriminator 1) 0x400d49ab: heap_caps_dump at /Users/odn/esp/esp-idf/components/heap/heap_caps.c:450 0x400d49be: heap_caps_dump_all at /Users/odn/esp/esp-idf/components/heap/heap_caps.c:457 0x400dc541: mqtt_recvtopic_jobs at /Users/odn/workspace/odn_device_rev2/components/mqtt_handle/Mqtt_handler.c:532 0x400dcd85: mqtt_recvprocessing at /Users/odn/workspace/odn_device_rev2/components/mqtt_handle/Mqtt_handler.c:359 (discriminator 1) 0x400dd0ed: mqtt_eventhandler at /Users/odn/workspace/odn_device_rev2/components/mqtt_handle/Mqtt_handler.c:293 0x40147fb9: handler_execute at /Users/odn/esp/esp-idf/components/esp_event/esp_event.c:135 0x40147a4e: esp_event_loop_run at /Users/odn/esp/esp-idf/components/esp_event/esp_event.c:584 0x400e53ba: esp_mqtt_dispatch_event at /Users/odn/esp/esp-idf/components/mqtt/esp-mqtt/mqtt_client.c:1032 0x400e5e1c: deliver_publish at /Users/odn/esp/esp-idf/components/mqtt/esp-mqtt/mqtt_client.c:1099 0x400e5f83: mqtt_process_receive at /Users/odn/esp/esp-idf/components/mqtt/esp-mqtt/mqtt_client.c:1377 0x400e6480: esp_mqtt_task at /Users/odn/esp/esp-idf/components/mqtt/esp-mqtt/mqtt_client.c:1657 0x400883f9: vPortTaskWrapper at /Users/odn/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:134
Core 1 register dump:
PC : 0x400858ee PS : 0x00060f34 A0 : 0x800d4496 A1 : 0x3ffb84c0
0x400858ee: esp_cpu_wait_for_intr at /Users/odn/esp/esp-idf/components/esp_hw_support/cpu.c:64
A2 : 0x00000000 A3 : 0x00000000 A4 : 0x3ffaf900 A5 : 0x3ffaf8e0
A6 : 0x40081ed0 A7 : 0x00000001 A8 : 0x800eb55a A9 : 0x3ffb8480
0x40081ed0: ipc_task at /Users/odn/esp/esp-idf/components/esp_system/esp_ipc.c:53
A10 : 0x00000000 A11 : 0x00000000 A12 : 0x3ffaf8e0 A13 : 0x3ffaf8c0
A14 : 0x00000001 A15 : 0x3ffb85b4 SAR : 0x00000000 EXCCAUSE: 0x00000005
EXCVADDR: 0x00000000 LBEG : 0x00000000 LEND : 0x00000000 LCOUNT : 0x00000000
Backtrace: 0x400858eb:0x3ffb84c0 0x400d4493:0x3ffb84e0 0x400894bd:0x3ffb8500 0x400883f9:0x3ffb8520 0x400858eb: xt_utils_wait_for_intr at /Users/odn/esp/esp-idf/components/xtensa/include/xt_utils.h:82 (inlined by) esp_cpu_wait_for_intr at /Users/odn/esp/esp-idf/components/esp_hw_support/cpu.c:55 0x400d4493: esp_vApplicationIdleHook at /Users/odn/esp/esp-idf/components/esp_system/freertos_hooks.c:58 0x400894bd: prvIdleTask at /Users/odn/esp/esp-idf/components/freertos/FreeRTOS-Kernel/tasks.c:4344 (discriminator 1) 0x400883f9: vPortTaskWrapper at /Users/odn/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:134`
This is the log just before heap output raw log. ` I (607459) [mqtt]: Event dispatched from event loop event_id=6 I (607459) [mqtt]: MQTT_EVENT_DATA, msg_id=0, topic[38]=$aws/things/testdev21/jobs/notify-next{"timestamp":1728619018,"execution":{"jobId":"AFR_OTA-testdev21_update42","status":"QUEUED","queuedAt":1728619016,"lastUpdatedAt":1728619016,"versionNumber":1,"executionNumber":1,"jobDocument":{"afr_ota":{"protocols":["MQTT"],"streamname":"AFR_OTA-ef4fecab-c7d0-4812-a5fd-fb86a739abdf","files":[{"filepath":"/","filesize":730304,"fileid":0,"certfile":"/main/certs/aws_codesign.crt","sig-sha256-ecdsa":"MEUCIEzzqvV1b6ra97DIV+AJzx2uVUtWiG4xtuPDi6dV5nYOAiEAmV7pw9Y3cPwb8l5SEHLPzqx7920FiQ9awPHd4dbS+/4="}]}}}} '�$�8��c��@&� �d��{I� I (610509) [mqtt]: sent publish successful, msg_id=0, topic = $aws/things/testdev21/jobs/start-next I (610509) [mqtt]: Event dispatched from event loop event_id=6 I (610509) [mqtt]: MQTT_EVENT_DATA, msg_id=0, topic[37]=$aws/things/testdev21/jobs/start-next{"clientToken": "device-dev"}ecution":{"jobId":"AFR_OTA-testdev21_update42","status":"QUEUED","queuedAt":1728619016,"lastUpdatedAt":1728619016,"versionNumber":1,"executionNumber":1,"jobDocument":{"afr_ota":{"protocols":["MQTT"],"streamname":"AFR_OTA-ef4fecab-c7d0-4812-a5fd-fb86a739abdf","files":[{"filepath":"/","filesize":730304,"fileid":0,"certfile":"/main/certs/aws_codesign.crt","sig-sha256-ecdsa":"MEUCIEzzqvV1b6ra97DIV+AJzx2uVUtWiG4xtuPDi6dV5nYOAiEAmV7pw9Y3cPwb8l5SEHLPzqx7920FiQ9awPHd4dbS+/4="}]}}}} '�$�8��c��@&� �d��{I� I (610569) [mqtt]: Event dispatched from event loop event_id=6 I (610569) [mqtt]: MQTT_EVENT_DATA, msg_id=0, topic[46]=$aws/things/testdev21/jobs/start-next/accepted{"clientToken":"device-dev","timestamp":1728619019,"execution":{"jobId":"AFR_OTA-testdev21_update42","status":"IN_PROGRESS","queuedAt":1728619016,"startedAt":1728619019,"lastUpdatedAt":1728619019,"versionNumber":2,"executionNumber":1,"jobDocument":{"afr_ota":{"protocols":["MQTT"],"streamname":"AFR_OTA-ef4fecab-c7d0-4812-a5fd-fb86a739abdf","files":[{"filepath":"/","filesize":730304,"fileid":0,"certfile":"/main/certs/aws_codesign.crt","sig-sha256-ecdsa":"MEUCIEzzqvV1b6ra97DIV+AJzx2uVUtWiG4xtuPDi6dV5nYOAiEAmV7pw9Y3cPwb8l5SEHLPzqx7920FiQ9awPHd4dbS+/4="}]}}}}�砂���Bp����5��e$�'�tޠ��g�r�� x��������$� A�9W��8�1�� r��FXy<yQ��Y�d�< I (610639) [mqtt]: jobs event_data = {"clientToken":"device-dev","timestamp":1728619019,"execution":{"jobId":"AFR_OTA-testdev21_update42","status":"IN_PROGRESS","queuedAt":1728619016,"startedAt":1728619019,"lastUpdatedAt":1728619019,"versionNumber":2,"executionNumber":1,"jobDocument":{"afr_ota":{"protocols":["MQTT"],"streamname":"AFR_OTA-ef4fecab-c7d0-4812-a5fd-fb86a739abdf","files":[{"filepath":"/","filesize":730304,"fileid":0,"certfile":"/main/certs/aws_codesign.crt","sig-sha256-ecdsa":"MEUCIEzzqvV1b6ra97DIV+AJzx2uVUtWiG4xtuPDi6dV5nYOAiEAmV7pw9Y3cPwb8l5SEHLPzqx7920FiQ9awPHd4dbS+/4="}]}}}}, I (610689) [mqtt]: job status : "IN_PROGRESS" I (610699) [mqtt]: Execute new OTA update task. (from factory partition) Showing data for heap: 0x3ffae6e0
To explain the log, " Event dispatched from event loop event_id=6 " => 데이터 이벤트 발생 ` 01-02 : aws -> device : $aws/things/(id)/jobs/notify-next 수신 ( status QUEUED ) 03 : device -> aws : $aws/things/(id)/jobs/start-next 로 응답 ( status QUEUED ) 04-05 : aws -> device : $aws/things/(id)/jobs/start-next 수신 ( status QUEUED ) 06-08 : aws -> device : $aws/things/(id)/jobs/start-next/accepted 수신 ( status IN_PROGRESS ) 09 after : device -> aws : $aws/things/(id)/streams/(stream-id)/get/json (Cannot proceed due to error)
`
The data that the device needs to pass to AWS is as follows.
char msg_mqtt_start[1000] ; sprintf(msg_mqtt_start, "{\"c\":%s, \"s\":%d, \"f\":%d,\"l\":%d,\"o\":%d,\"n\":%d}", CONFIG_OTA_CLIENT_TOKEN, CONFIG_OTA_STREAM_VERSION, (int)ota_stream.total.file_size, CONFIG_OTA_STREAM_BLOCK_SIZE, ota_stream.block_offset, ota_stream.request_block_num); "{ "c": "device-dev", "s": 1, "f": 730304, "l": 4096, "o": 0, "n": 0 }"
It looks like the data from ota should be sent to the stream immediately after this, but an error occurs before that happens.
@Gyunamchoi, it seems that the heap memory got corrupted along the line. you have to find out where exactly. You can use heap_caps_check_integrity_all(true);
(esp_heap_caps.h
) at different places in the code to find which part of it induced the corruption. Make sure that the comprehensive poisoning is enabled in the menuconfig ( Component config
→ Heap memory debugging
→ heap corruption detection
).
hello @SoucheSouche.
As you advised, I enabled comprehensive poisoning, added heap_caps_check_integrity_all(true); in several places, and checked for memory corruption. This is the code of the corrupt heap right before the problem occurred. Please check.
`I (50769) [mqtt]: Execute new OTA update task. (from factory partition) CORRUPT HEAP: Bad tail at 0x3ffcf320. Expected 0xbaad5678 got 0xffffffff CORRUPT HEAP: Invalid data at 0x3ffcf334. Expected 0xfefefefe got 0x3ffc52b4 CORRUPT HEAP: Invalid data at 0x3ffcf338. Expected 0xfefefefe got 0x3767029e CORRUPT HEAP: Invalid data at 0x3ffcf33c. Expected 0xfefefefe got 0x78141a98 CORRUPT HEAP: Invalid data at 0x3ffcf340. Expected 0xfefefefe got 0x1d7fce4e CORRUPT HEAP: Invalid data at 0x3ffcf344. Expected 0xfefefefe got 0xadf51b98 CORRUPT HEAP: Invalid data at 0x3ffcf348. Expected 0xfefefefe got 0x8d482231 CORRUPT HEAP: Invalid data at 0x3ffcf34c. Expected 0xfefefefe got 0xd2d47c66 CORRUPT HEAP: Invalid data at 0x3ffcf350. Expected 0xfefefefe got 0x48d1ad6b CORRUPT HEAP: Invalid data at 0x3ffcf354. Expected 0xfefefefe got 0xf45bfd9c CORRUPT HEAP: Invalid data at 0x3ffcf358. Expected 0xfefefefe got 0xdbcbf209 CORRUPT HEAP: Invalid data at 0x3ffcf35c. Expected 0xfefefefe got 0xf4ed7d9c CORRUPT HEAP: Invalid data at 0x3ffcf360. Expected 0xfefefefe got 0xe3302886 CORRUPT HEAP: Invalid data at 0x3ffcf364. Expected 0xfefefefe got 0x2c285da1 CORRUPT HEAP: Invalid data at 0x3ffcf368. Expected 0xfefefefe got 0x457f49b1 CORRUPT HEAP: Invalid data at 0x3ffcf36c. Expected 0xfefefefe got 0xd925344d CORRUPT HEAP: Invalid data at 0x3ffcf370. Expected 0xfefefefe got 0x8e55f80a CORRUPT HEAP: Invalid data at 0x3ffcf374. Expected 0xfefefefe got 0x5f5837f3 CORRUPT HEAP: Invalid data at 0x3ffcf378. Expected 0xfefefefe got 0xb8ff7f04 CORRUPT HEAP: Invalid data at 0x3ffcf37c. Expected 0xfefefefe got 0x3702ca47 CORRUPT HEAP: Invalid data at 0x3ffcf380. Expected 0xfefefefe got 0xb8c93118 CORRUPT HEAP: Invalid data at 0x3ffcf384. Expected 0xfefefefe got 0x0e9f0a15 CORRUPT HEAP: Invalid data at 0x3ffcf388. Expected 0xfefefefe got 0xba692d56 CORRUPT HEAP: Invalid data at 0x3ffcf38c. Expected 0xfefefefe got 0xed367bec CORRUPT HEAP: Invalid data at 0x3ffcf390. Expected 0xfefefefe got 0xe090a69a CORRUPT HEAP: Invalid data at 0x3ffcf394. Expected 0xfefefefe got 0xd6097dbf CORRUPT HEAP: Invalid data at 0x3ffcf398. Expected 0xfefefefe got 0x2ba89c60 CORRUPT HEAP: Invalid data at 0x3ffcf39c. Expected 0xfefefefe got 0xe9e7d1c2 CORRUPT HEAP: Invalid data at 0x3ffcf3a0. Expected 0xfefefefe got 0xaa32d2de CORRUPT HEAP: Invalid data at 0x3ffcf3a4. Expected 0xfefefefe got 0x68a640d7 CORRUPT HEAP: Invalid data at 0x3ffcf3a8. Expected 0xfefefefe got 0x62264983 CORRUPT HEAP: Invalid data at 0x3ffcf3ac. Expected 0xfefefefe got 0x4355f993 CORRUPT HEAP: Invalid data at 0x3ffcf3b0. Expected 0xfefefefe got 0x56fbca0d CORRUPT HEAP: Invalid data at 0x3ffcf3b4. Expected 0xfefefefe got 0x5baf764c CORRUPT HEAP: Invalid data at 0x3ffcf3b8. Expected 0xfefefefe got 0xbaad5678 CORRUPT HEAP: Invalid data at 0x3ffcf3bc. Expected 0xfefefefe got 0x00000649 CORRUPT HEAP: Invalid data at 0x3ffcf3c0. Expected 0xfefefefe got 0x3ffb5664 CORRUPT HEAP: Invalid data at 0x3ffcf3c4. Expected 0xfefefefe got 0x3ffb5664 CORRUPT HEAP: Invalid data at 0x3ffcfa04. Expected 0xfefefefe got 0x3ffcf3b8 CORRUPT HEAP: Invalid data at 0x3ffcfa08. Expected 0xfefefefe got 0x00000042 CORRUPT HEAP: Invalid data at 0x3ffcfa0c. Expected 0xfefefefe got 0xabba1234 CORRUPT HEAP: Invalid data at 0x3ffcfa10. Expected 0xfefefefe got 0x0000002c CORRUPT HEAP: Invalid data at 0x3ffcfa14. Expected 0xfefefefe got 0x3ffc52b4 CORRUPT HEAP: Invalid data at 0x3ffcfa18. Expected 0xfefefefe got 0x3ffcebc8 CORRUPT HEAP: Invalid data at 0x3ffcfa1c. Expected 0xfefefefe got 0x00000046 CORRUPT HEAP: Invalid data at 0x3ffcfa20. Expected 0xfefefefe got 0x0000Guru Meditation Error: Core 0 panic'ed (Interrupt wdt timeout on CPU0).
Core 0 register dump:
PC : 0x40009222 PS : 0x00060734 A0 : 0x80007d16 A1 : 0x3ffc4da0
0x40009222: uart_tx_one_char in ROM
A2 : 0x00800000 A3 : 0x38000000 A4 : 0x00000000 A5 : 0x0000000d
A6 : 0x3ffcf32c A7 : 0x3ffcf324 A8 : 0x3ff40000 A9 : 0x00000037
A10 : 0x00800000 A11 : 0x3ff4001c A12 : 0x00000000 A13 : 0x3ffc4f30
A14 : 0xffffffff A15 : 0x00000001 SAR : 0x00000005 EXCCAUSE: 0x00000005
EXCVADDR: 0x00000000 LBEG : 0x4000c349 LEND : 0x4000c36b LCOUNT : 0xffffffff
0x4000c349: memcpy in ROM
0x4000c36b: memcpy in ROM
Backtrace: 0x4000921f:0x3ffc4da0 0x40007d13:0x3ffc4dc0 0x40007c69:0x3ffc4de0 0x40008106:0x3ffc4e00 0x4008cea1:0x3ffc4e90 0x4008ccb1:0x3ffc4eb0 0x40148e9b:0x3ffc4ed0 0x40149201:0x3ffc4ef0 0x40149343:0x3ffc4f10 0x4014938f:0x3ffc4f30 0x40148ee7:0x3ffc4f60 0x400d42f5:0x3ffc4f80 0x400d4319:0x3ffc4fa0 0x400dce47:0x3ffc4fc0 0x400dbd82:0x3ffc4fe0 0x400dc509:0x3ffc5030 0x400dc882:0x3ffc5050 0x401481bd:0x3ffc50f0 0x40147c52:0x3ffc5120 0x400e4dfe:0x3ffc5160 0x400e5860:0x3ffc5180 0x400e59c7:0x3ffc51b0 0x400e5ec4:0x3ffc51e0 0x40088425:0x3ffc5210 0x4000921f: uart_tx_one_char in ROM 0x40007d13: ets_write_char_uart in ROM 0x40007c69: ets_write_char in ROM 0x40008106: ets_printf in ROM 0x4008cea1: verify_fill_pattern at /Users/odn/esp/esp-idf/components/heap/multi_heap_poisoning.c:153 0x4008ccb1: multi_heap_internal_check_block_poisoning at /Users/odn/esp/esp-idf/components/heap/multi_heap_poisoning.c:421 0x40148e9b: tlsf_check_hook at /Users/odn/esp/esp-idf/components/heap/multi_heap.c:329 0x40149201: integrity_walker at /Users/odn/esp/esp-idf/components/heap/tlsf/tlsf.c:689 0x40149343: tlsf_walk_pool at /Users/odn/esp/esp-idf/components/heap/tlsf/tlsf.c:771 0x4014938f: tlsf_check_pool at /Users/odn/esp/esp-idf/components/heap/tlsf/tlsf.c:798 0x40148ee7: multi_heap_check at /Users/odn/esp/esp-idf/components/heap/multi_heap.c:350 (discriminator 1) 0x400d42f5: heap_caps_check_integrity at /Users/odn/esp/esp-idf/components/heap/heap_caps.c:422 0x400d4319: heap_caps_check_integrity_all at /Users/odn/esp/esp-idf/components/heap/heap_caps.c:431 0x400dce47: ota_request_start_stream at /Users/odn/workspace/odn_device_rev2/components/ota_update/ota_updater.c:84 0x400dbd82: mqtt_recvtopic_jobs at /Users/odn/workspace/odn_device_rev2/components/mqtt_handle/mqtt_handler.c:517 0x400dc509: mqtt_recvprocessing at /Users/odn/workspace/odn_device_rev2/components/mqtt_handle/mqtt_handler.c:362 (discriminator 1) 0x400dc882: mqtt_eventhandler at /Users/odn/workspace/odn_device_rev2/components/mqtt_handle/mqtt_handler.c:296 0x401481bd: handler_execute at /Users/odn/esp/esp-idf/components/esp_event/esp_event.c:135 0x40147c52: esp_event_loop_run at /Users/odn/esp/esp-idf/components/esp_event/esp_event.c:584 0x400e4dfe: esp_mqtt_dispatch_event at /Users/odn/esp/esp-idf/components/mqtt/esp-mqtt/mqtt_client.c:1032 0x400e5860: deliver_publish at /Users/odn/esp/esp-idf/components/mqtt/esp-mqtt/mqtt_client.c:1099 0x400e59c7: mqtt_process_receive at /Users/odn/esp/esp-idf/components/mqtt/esp-mqtt/mqtt_client.c:1377 0x400e5ec4: esp_mqtt_task at /Users/odn/esp/esp-idf/components/mqtt/esp-mqtt/mqtt_client.c:1657 0x40088425: vPortTaskWrapper at /Users/odn/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:134
Core 1 register dump:
PC : 0x4008591a PS : 0x00060a34 A0 : 0x800d3dd6 A1 : 0x3ffb86c0
0x4008591a: esp_cpu_wait_for_intr at /Users/odn/esp/esp-idf/components/esp_hw_support/cpu.c:64
A2 : 0x00000000 A3 : 0x00000000 A4 : 0x3ffaf9f0 A5 : 0x3ffaf9d0
A6 : 0x40081efc A7 : 0x00000001 A8 : 0x800eaf9e A9 : 0x3ffb8680
0x40081efc: ipc_task at /Users/odn/esp/esp-idf/components/esp_system/esp_ipc.c:53
A10 : 0x00000000 A11 : 0x00000001 A12 : 0x800887ca A13 : 0x3ffc4b60
A14 : 0x00000003 A15 : 0x3ffb87c4 SAR : 0x00000000 EXCCAUSE: 0x00000005
EXCVADDR: 0x00000000 LBEG : 0x00000000 LEND : 0x00000000 LCOUNT : 0x00000000
Backtrace: 0x40085917:0x3ffb86c0 0x400d3dd3:0x3ffb86e0 0x400894e9:0x3ffb8700 0x40088425:0x3ffb8720 0x40085917: xt_utils_wait_for_intr at /Users/odn/esp/esp-idf/components/xtensa/include/xt_utils.h:82 (inlined by) esp_cpu_wait_for_intr at /Users/odn/esp/esp-idf/components/esp_hw_support/cpu.c:55 0x400d3dd3: esp_vApplicationIdleHook at /Users/odn/esp/esp-idf/components/esp_system/freertos_hooks.c:58 0x400894e9: prvIdleTask at /Users/odn/esp/esp-idf/components/freertos/FreeRTOS-Kernel/tasks.c:4344 (discriminator 1) 0x40088425: vPortTaskWrapper at /Users/odn/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:134`
Hi @Gyunamchoi, Can you help share the esp-aws-iot branch you're on? Also, can you try with standard OTA example ? We looked at your code, could you verify whether recv_topic and recv_data are being properly freed, including edge cases? If not, please provide the relevant code snippet that handles the freeing or utilization of these resources.
@kvp1703 Oh I'm Sorry. It's been resolved, but I didn't close it. There was a subtle mismatch in the size and timing when allocating, using, and freeing memory. It's resolved now and it works fine. Thank you for your interest.
Answers checklist.
IDF version.
ESP-IDF v5.3 2nd stage bootloader
Espressif SoC revision.
ESP32-WROOM-32UE chip revision: v3.1
Operating System used.
macOS
How did you build your project?
Command line with idf.py
If you are using Windows, please specify command line type.
None
Development Kit.
custom board (ESP32-WROOM-32UE)
Power Supply used.
USB
What is the expected behavior?
The ultimate goal is to proceed with OTA updates through aws-iot.
What is the actual behavior?
An error related to heap_caps occurs when allocating memory such as malloc.
Steps to reproduce.
Debug Logs.
More Information.
I will write down the source code part where a very short problem can occur.
Initialze mqtt `esp_err_t mqtt_initialize(){ esp_err_t err = ESP_OK; ESP_LOGI(TAG, "mqtt start intialization."); mqtt_client = esp_mqtt_client_init(&mqtt_config); err = esp_mqtt_client_register_event(mqtt_client, MQTT_EVENT_ANY, &mqtt_eventhandler, mqtt_client); err = esp_mqtt_client_start(mqtt_client); return err; }
void mqtt_eventhandler(void arg, esp_event_base_t base, int32_t event_id, void event_data) esp_mqtt_event_handle_t event = event_data; switch ((esp_mqtt_event_id_t)event_id) { case MQTT_EVENT_CONNECTED: break; case MQTT_EVENT_DISCONNECTED: break;
}
esp_err_t mqtt_recvprocessing(char recv_topic, char recv_data){ ( parsing aws iot topic ) if(!strcmp(parts, "jobs")){ // Event Data string to JSON Structure err = mqtt_recvtopic_jobs(strtok(NULL, END_TOKEN), recv_data);
} }
esp_err_t mqtt_recvtopic_jobs(char remain_topic, char event_data){ esp_err_t err = ESP_OK; // Event Data string to JSON Structure cJSON json_jobs = cJSON_Parse(event_data); if(json_jobs != NULL){ cJSON json_execution = cJSON_GetObjectItem(json_jobs, "execution"); cJSON* json_status = cJSON_GetObjectItem(json_execution, "status");
// char* msg_mqtt_start = ota_request_start_stream(json_otadocument); ESP_LOGI(TAG, "topic_mqtt_start =%s msg_mqtt_start = %s ", topic_mqtt_start, msg_mqtt_start);
mqtt_publish(topic_mqtt_start, msg_mqtt_start);** ESP_LOGI(TAG, "Start ota [%s] from factory mode to stream image file request complete.",stream_id); free(topic_mqtt_start); free(msg_mqtt_start); } else { ` mqtt message process
When creating cJSON, cJSON_CreateObject() uses malloc, so a kernel panic occurs, and the same problem occurs in esp_mqtt_publish() when publishing. A heap_caps_calloc error occurs when performing memory-related operations. Whether creating with malloc, creating with fixed generation, or using cJSON, the same problem occurs in the same part.
There is about 170KB of free heap memory, and there are no problems at all in periodic message publishing, except for the jobs-related part.
I have no idea whether it is a problem with the mqtt module itself when publishing, a problem with another part, or a problem with json. Please help me.
Thank you.