Skip to content

ESP RTC crashing due to heap corruption after several hours (AUD-6549) #1501

@vasilerares

Description

@vasilerares

----------------------------- Delete below -----------------------------

Reminder: If your issue is a general question, start similar to "How do I..". If it is related to 3rd party development kits/libs, please discuss this on our community forum at https://esp32.com instead.

  • I have read the documentation Espressif Advanced Development Framework Guide and the issue is not addressed there.
  • I have updated my ADF and IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

Environment

  • Audio development kit: none
  • Audio kit version (for ESP32-LyraT/ESP32-LyraT-Mini/ESP32-S3-Korvo-2): [v1|v2|v3|v4]
  • [Required] Module or chip used: [ESP32-WROOM-32E|ESP32-WROVER-E|ESP32-S2-WROVER|ESP32-S3-WROOM-1]
  • [Required] IDF version (run git describe --tags in $IDF_PATH folder to find it):
    // v5.3.3-927-gbf79937908
  • [Required] ADF version (run git describe --tags in $ADF_PATH folder to find it):
    // 7b987ee
  • Build system: idf.py
  • [Required] Running log: All logs from power-on to problem recurrence
  • Compiler version (run xtensa-esp32-elf-gcc --version in your project folder to find it):
    // xtensa-esp-elf-gcc (crosstool-NG esp-13.2.0_20240530) 13.2.0
  • Operating system: macOS/Linux
  • (Windows only) Environment type: [MSYS2 mingw32|ESP Command Prompt|Plain Command Prompt|PowerShell]
  • Using an IDE?: VSCode
  • Power supply: USB

Problem Description

esp_rtc component to connect to a sip server(hosted by kamailio) is connecting fine, reconnects for several hours and then it crashes due to a heap corruption even if no other user tasks are executing.

The existing sdkconfig uses Comprehensive heap canaries.

Expected Behavior

There is no crash

Actual Behavior

Application crashes when freeing the memory after several hours.

Steps to Reproduce

  1. Setup a Sip Server - we used kamailio
  2. Use the provided application in the zip file
  3. Replace the placeholders in line 52-61
    // If possible, attach a picture of your setup/wiring here.
    No special wiring is needed, just a ESP32 devkit V1

Code to Reproduce This Issue

(https://gist.github.com/vasilerares/1383e461945c22b635a59f7f4347c994)

Debug Logs

SIP/2.0 200 OK

Via: SIP/2.0/TLS server-ip:5061;branch=z9hG4bKx.94922.1.0

Contact: <sip:[email protected]:51479;transport=TLS>

From: <sip:[email protected]>;tag=uloc-686fbe63-1ed797-5202-cd6be8b4-68779f13-68945-172ca.1

To: <sip:[email protected]>;tag=-1475071133

Call-ID: ksrulka-3f8c592b-1ed78a-172ca.1

CSeq: 80 OPTIONS

Server: ESP32 SIP/2.0

Allow: ACK, INVITE, BYE, UPDATE, CANCEL, OPTIONS, INFO

Content-Length: 0

Accept: application/sdp, application/sdp

Allow: INVITE, ACK, CANCEL, BYE, UPDATE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE

Supported: replaces, norefersub, extended-refer, timer, X-cisco-serviceuri

User-Agent: ESP32 SIP/2.0

Allow-Events: presence, kpml



�[0m
�[0;32mI (11910365) SIP: [2025-07-16/12:46:05]=======================>>�[0m
�[0;32mI (11910375) main: Running heap check�[0m
�[0;32mI (11910385) main: heap free: 203600�[0m
�[0;32mI (11916435) SIP: Sending keep-alive to server�[0m
�[0;33mW (11917475) SIP: CHANGE STATE FROM 2, TO 0, :func: sip_reconnect:385�[0m

assert failed: heap_caps_free heap_caps_base.c:75 (heap != NULL && "free() target pointer is outside heap areas")


Backtrace: 0x40081b3a:0x3ffcd470 0x40089895:0x3ffcd490 0x40091425:0x3ffcd4b0 0x400823cb:0x3ffcd5d0 0x40091455:0x3ffcd5f0 0x400db3ad:0x3ffcd610 0x400dc243:0x3ffcd630 0x400dd234:0x3ffcd650 0x400dd746:0x3ffcd680 0x4008a3e1:0x3ffcd6e0

0x40081b3a: panic_abort at test/.devcontainer/esp/idf/components/esp_system/panic.c:478
0x40089895: esp_system_abort at test/.devcontainer/esp/idf/components/esp_system/port/esp_system_chip.c:87
0x40091425: __assert_func at test/.devcontainer/esp/idf/components/newlib/assert.c:80
0x400823cb: heap_caps_free at test/.devcontainer/esp/idf/components/heap/heap_caps_base.c:75 (discriminator 1)
0x40091455: free at test/.devcontainer/esp/idf/components/newlib/heap.c:39
0x400db3ad: media_lib_free at test/.devcontainer/esp/adf/components/esp-adf-libs/media_lib_sal/media_lib_os.c:86
0x400dc243: _sip_clean_parse at /builds/adf/esp-adf-libs-source/esp_media_protocols/esp_rtc/esp_rtc_core/esp_rtc_sip/esp_rtc_sip.c:319 (discriminator 1)
0x400dd234: sip_reconnect at /builds/adf/esp-adf-libs-source/esp_media_protocols/esp_rtc/esp_rtc_core/esp_rtc_sip/esp_rtc_sip.c:387
0x400dd746: sip_connect at /builds/adf/esp-adf-libs-source/esp_media_protocols/esp_rtc/esp_rtc_core/esp_rtc_sip/esp_rtc_sip.c:1815
 (inlined by) _sip_task at /builds/adf/esp-adf-libs-source/esp_media_protocols/esp_rtc/esp_rtc_core/esp_rtc_sip/esp_rtc_sip.c:1997
0x4008a3e1: vPortTaskWrapper at test/.devcontainer/esp/idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:139



full log

Other Items If Possible

  • [test.zip] sdkconfig file (Attach the sdkconfig file from your project folder)
  • elf file in the build folder (Note this may contain all the code details and symbols of your project.)
  • coredump (This provides stacks of tasks.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions