espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.82k stars 7.32k forks source link

`malloc` fails in some situations when a certain combination of build settings is enabled (IDFGH-13605) #14492

Closed mphe closed 2 months ago

mphe commented 2 months ago

Answers checklist.

IDF version.

master, 5.2.2, 5.2.1

Espressif SoC revision.

ESP32-S3-WROOM-2-N32R8V

Operating System used.

Linux

How did you build your project?

Command line with idf.py

If you are using Windows, please specify command line type.

None

Development Kit.

ESP32-S3-DevKitC-1

Power Supply used.

USB

What is the expected behavior?

malloc calls succeed as long as there is sufficient memory with the requested capabilities, regardless of build settings.

What is the actual behavior?

heap_caps_calloc fails to allocate memory ("Mem alloc fail") even though enough memory should be available, but only in certain situations and when a certain combination of build settings is enabled.

While working on a project with esp-matter I suddenly encountered crashes due to memory allocation fails after changing some build settings using idf.py menuconfig. Without CONFIG_HEAP_ABORT_WHEN_ALLOCATION_FAILS=y, the program will not crash immediately but still cause errors and possibly crash at a later point due to access to uninitialized data/subsystems.

Steps to reproduce.

  1. Set up IDF + esp-matter as documented in https://docs.espressif.com/projects/esp-matter/en/latest/esp32/developing.html#esp-matter-setup
  2. Source IDF and esp-matter export.sh
  3. Go to esp-matter/examples/controller
  4. Run idf.py set-target esp32s3
  5. Copy the provided sdkconfig to the project.
  6. Run idf.py (erase-flash) flash monitor and observe the program crashing at the "chip[IN]: CASE Server enabling CASE session setups" step

I was unable to reproduce a failing malloc on my own but the controller example of esp-matter works as a MRP. During client initialization, a call to heap_caps_calloc invoked by mbedTLS will fail. See also the included crash log. There could also be more places where these settings lead to failing mallocs besides mbedTLS.

I tried to strip down the changes in sdkconfig to a minimum and found the following build settings to reliably reproduce the error. It is possible that there are also other combinations that cause the same issue.

Besides these settings the controller example is unchanged.

I included a patch file containing the diffs between the default sdkconfig and the failing version, as well as the whole failing sdkconfig. The patch file also includes other changes that were made automatically by the build system upon changing certain settings, e.g. enabling PSRAM.

sdkconfig_diff.txt sdkconfig.txt

Debug Logs.

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
Octal Flash Mode Enabled
For OPI Flash, Use Default Flash Boot Mode
mode:SLOW_RD, clock div:1
load:0x3fce3810,len:0x178c
load:0x403c9700,len:0x4
load:0x403c9704,len:0xcbc
load:0x403cc700,len:0x2d9c
entry 0x403c9914
I (34) boot: ESP-IDF v5.2.2 2nd stage bootloader
I (35) boot: compile time Sep  3 2024 12:02:37
I (35) boot: Multicore bootloader
I (38) boot: chip revision: v0.1
I (42) boot.esp32s3: Boot SPI Speed : 80MHz
I (46) boot.esp32s3: SPI Mode       : SLOW READ
I (52) boot.esp32s3: SPI Flash Size : 4MB
I (56) boot: Enabling RNG early entropy source...
I (62) boot: Partition Table:
I (65) boot: ## Label            Usage          Type ST Offset   Length
I (73) boot:  0 esp_secure_cert  unknown          3f 06 0000d000 00002000
I (80) boot:  1 nvs              WiFi data        01 02 00010000 0000c000
I (88) boot:  2 nvs_keys         NVS keys         01 04 0001c000 00001000
I (95) boot:  3 otadata          OTA data         01 00 0001d000 00002000
I (102) boot:  4 phy_init         RF data          01 01 0001f000 00001000
I (110) boot:  5 ota_0            OTA app          00 10 00020000 001e0000
I (118) boot:  6 ota_1            OTA app          00 11 00200000 001e0000
I (125) boot:  7 paa_cert         Unknown data     01 82 003e0000 00020000
I (133) boot: End of partition table
I (137) boot: No factory image, trying OTA 0
I (142) esp_image: segment 0: paddr=00020020 vaddr=3c170020 size=4fdb0h (327088) map
I (228) esp_image: segment 1: paddr=0006fdd8 vaddr=3fc9bd00 size=00240h (   576) load
I (229) esp_image: segment 2: paddr=00070020 vaddr=42000020 size=1604d4h (1443028) map
I (577) esp_image: segment 3: paddr=001d04fc vaddr=3fc9bf40 size=056f4h ( 22260) load
I (583) esp_image: segment 4: paddr=001d5bf8 vaddr=40374000 size=17cc4h ( 97476) load
I (620) boot: Loaded app from partition at offset 0x20000
I (648) boot: Set actual ota_seq=1 in otadata[0]
I (648) boot: Disabling RNG early entropy source...
I (659) cpu_start: Multicore app
I (659) octal_psram: vendor id    : 0x0d (AP)
I (659) octal_psram: dev id       : 0x02 (generation 3)
I (662) octal_psram: density      : 0x03 (64 Mbit)
I (668) octal_psram: good-die     : 0x01 (Pass)
I (673) octal_psram: Latency      : 0x01 (Fixed)
I (678) octal_psram: VCC          : 0x00 (1.8V)
I (683) octal_psram: SRF          : 0x01 (Fast Refresh)
I (689) octal_psram: BurstType    : 0x01 (Hybrid Wrap)
I (695) octal_psram: BurstLen     : 0x01 (32 Byte)
I (701) octal_psram: Readlatency  : 0x02 (10 cycles@Fixed)
I (707) octal_psram: DriveStrength: 0x00 (1/1)
I (712) esp_psram: Found 8MB PSRAM device
I (717) esp_psram: Speed: 40MHz
I (1451) esp_psram: SPI SRAM memory test OK
I (1460) cpu_start: Pro cpu start user code
I (1460) cpu_start: cpu freq: 160000000 Hz
I (1460) cpu_start: Application information:
I (1464) cpu_start: Project name:     controller
I (1469) cpu_start: App version:      22fad12
I (1474) cpu_start: Compile time:     Sep  3 2024 12:02:39
I (1480) cpu_start: ELF file SHA256:  85ec0c0c7...
I (1486) cpu_start: ESP-IDF:          v5.2.2
I (1490) cpu_start: Min chip rev:     v0.0
I (1495) cpu_start: Max chip rev:     v0.99
I (1500) cpu_start: Chip rev:         v0.1
I (1505) heap_init: Initializing. RAM available for dynamic allocation:
I (1512) heap_init: At 3FCB7000 len 00032710 (201 KiB): RAM
I (1519) heap_init: At 3FCE9710 len 00005724 (21 KiB): RAM
I (1525) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM
I (1531) heap_init: At 600FE010 len 00001FD8 (7 KiB): RTCRAM
I (1537) esp_psram: Adding pool of 8192K of PSRAM memory to heap allocator
W (1545) spi_flash: Octal flash chip is using but dio mode is selected, will automatically swich to Octal mode
I (1556) spi_flash: detected chip: mxic (opi)
I (1561) spi_flash: flash io: opi_str
W (1565) spi_flash: Detected size(32768k) larger than the size in the binary image header(4096k). Using the size in the binary image header.
I (1579) sleep: Configure to isolate all GPIO pins in sleep state
I (1585) sleep: Enable automatic switching of GPIO sleep configuration
I (1592) esp_core_dump_uart: Init core dump to UART
I (1598) coexist: coex firmware version: d96c1e51f
I (1603) coexist: coexist rom version e7ae62f
I (1609) main_task: Started on CPU0
I (1619) esp_psram: Reserving pool of 32K of internal memory for DMA/internal allocations
I (1619) main_task: Calling app_main()
I (1739) pp: pp rom version: e7ae62f
I (1739) net80211: net80211 rom version: e7ae62f
I (1749) wifi:wifi driver task: 3fccdd5c, prio:23, stack:6656, core=0
                                                                                                                      I (1749) wifi:wifi firmware version: 3e0076f
I (1749) wifi:wifi certification version: v7.0
I (1759) wifi:config NVS flash: enabled
I (1759) wifi:config nano formating: disabled
I (1759) wifi:Init data frame dynamic rx buffer num: 32
I (1769) wifi:Init static rx mgmt buffer num: 5
> I (1779) wifi:Init management short buffer num: 32
I (1779) wifi:Init static tx buffer num: 16
I (1789) wifi:Init tx cache buffer num: 32
I (1789) wifi:Init static tx FG buffer num: 2
I (1789) wifi:Init static rx buffer size: 1600
I (1799) wifi:Init static rx buffer num: 10
I (1799) wifi:Init dynamic rx buffer num: 32
I (1799) wifi_init: rx ba win: 6
I (1799) wifi_init: tcpip mbox: 32
I (1809) wifi_init: udp mbox: 6
I (1809) wifi_init: tcp mbox: 6
I (1809) wifi_init: tcp tx win: 5760
I (1829) wifi_init: tcp rx win: 5760
I (1829) wifi_init: tcp mss: 1440
I (1829) wifi_init: WiFi IRAM OP enabled
I (1839) wifi_init: WiFi RX IRAM OP enabled
I (1849) chip[DL]: NVS set: chip-counters/reboot-count = 1 (0x1)
I (1849) chip[DL]: NVS set: chip-counters/total-hours = 0 (0x0)
I (1849) chip[DL]: NVS set: chip-config/unique-id = "9EEB5740493C0858"
I (1859) chip[DL]: Changing ESP WiFi mode: AP -> STA+AP
I (1869) chip[DL]: Changing ESP WiFi mode: STA+AP -> STA
I (1879) chip[DL]: Real time clock set to 946684800 (0100/00/01 00:00:00 UTC)
I (1879) BLE_INIT: BT controller compile version [c23ab4c]
I (1889) BLE_INIT: Bluetooth MAC: 34:85:18:a1:3f:6a
I (1899) phy_init: phy_version 670,b7bc9b9,Apr 30 2024,10:54:13
W (1899) phy_init: failed to load RF calibration data (0x1102), falling back to full calibration
I (1959) NimBLE: GAP procedure initiated: stop advertising.

I (1959) NimBLE: Failed to restore IRKs from store; status=8

I (1959) CHIP[DL]: BLE host-controller synced
I (2469) chip[DL]: Starting ESP WiFi layer
I (2469) wifi:mode : sta (34:85:18:a1:3f:68)
I (2469) wifi:enable tsf
W (2469) wifi:Haven't to connect to a suitable AP now!
I (2469) chip[DL]: I (2469) chip[DL]: Posting ESPSystemEvent: Wifi Event with eventId : 41Done driving station state, nothing else to do...
W (2489) wifi:Haven't to connect to a suitable AP now!
I (2489) chip[DL]: Done driving station state, nothing else to do...

I (2499) chip[DL]: HandlePlatformSpecificBLEEvent 49152
I (2499) chip[DL]: Posting ESPSystemEvent: Wifi Event with eventId : 2
I (2509) chip[DL]: HandlePlatformSpecificBLEEvent 49152
I (2519) chip[DL]: WIFI_EVENT_STA_START
W (2519) wifi:Haven't to connect to a suitable AP now!
I (2529) chip[DL]: Done driving station state, nothing else to do...
I (2539) chip[CTL]: Setting attestation nonce to random value
I (2549) chip[CTL]: Setting CSR nonce to random value
I (2549) chip[CTL]: Setting attestation nonce to random value
I (2559) chip[CTL]: Setting CSR nonce to random value
I (2559) chip[TS]: Last Known Good Time: [unknown]
I (2559) chip[TS]: Setting Last Known Good Time to firmware build time 2023-10-14T01:16:48
I (2579) chip[IN]: CASE Server enabling CASE session setups
I (2589) chip[CTL]: Couldn't get ExampleOpCredsCAKey from storage: Error CHIP:0x000000A0

Mem alloc fail. size 0x00000018 caps 0x00000008

Backtrace: 0x40375b96:0x3fcbbd60 0x40380695:0x3fcbbd80 0x4037611b:0x3fcbbda0 0x40376461:0x3fcbbe00 0x421298f0:0x3fcbbe20 0x42129c0e:0x3fcbbe60 0x421207db:0x3fcbbe80 0x42120829:0x3fcbbee0 0x4206719e:0x3fcbbf00 0x420671b1:0x3fcbbf20 0x4211f3c2:0x3fcbbf40 0x4211f40e:0x3fcbbf70 0x4211ec9f:0x3fcbbfb0 0x42122f47:0x3fcbbfd0 0x42122f69:0x3fcbbff0 0x42122f9b:0x3fcbc020 0x42122fc1:0x3fcbc040 0x420672ee:0x3fcbc060 0x42097e01:0x3fcbc090 0x42012836:0x3fcbc150 0x42011533:0x3fcbc170 0x4200ae8c:0x3fcbc4e0 0x4215f578:0x3fcbc510 0x40381102:0x3fcbc540
0x40375b96: panic_abort at /home/user/esp/5.2.2/components/esp_system/panic.c:466
0x40380695: esp_system_abort at /home/user/esp/5.2.2/components/esp_system/port/esp_system_chip.c:93
0x4037611b: heap_caps_alloc_failed at /home/user/esp/5.2.2/components/heap/heap_caps.c:96
0x40376461: heap_caps_calloc at /home/user/esp/5.2.2/components/heap/heap_caps.c:528
0x421298f0: esp_aes_process_dma at /home/user/esp/5.2.2/components/mbedtls/port/aes/dma/esp_aes.c:393
0x42129c0e: esp_aes_crypt_ecb at /home/user/esp/5.2.2/components/mbedtls/port/aes/dma/esp_aes.c:735
0x421207db: mbedtls_ctr_drbg_random_with_add at /home/user/esp/5.2.2/components/mbedtls/mbedtls/library/ctr_drbg.c:659
0x42120829: mbedtls_ctr_drbg_random at /home/user/esp/5.2.2/components/mbedtls/mbedtls/library/ctr_drbg.c:708
0x4206719e: chip::Crypto::DRBG_get_bytes(unsigned char*, unsigned int) at /home/user/Dokumente/matter/esp-matter/examples/controller/build/esp-idf/chip/../../../../../connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/src/crypto/CHIPCryptoPALmbedTLS.cpp:440 (discriminator 1)
 (inlined by) chip::Crypto::DRBG_get_bytes(unsigned char*, unsigned int) at /home/user/Dokumente/matter/esp-matter/examples/controller/build/esp-idf/chip/../../../../../connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/src/crypto/CHIPCryptoPALmbedTLS.cpp:432 (discriminator 1)
0x420671b1: chip::Crypto::CryptoRNG(void*, unsigned char*, unsigned int) at /home/user/Dokumente/matter/esp-matter/examples/controller/build/esp-idf/chip/../../../../../connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/src/crypto/CHIPCryptoPALmbedTLS.cpp:448
0x4211f3c2: mbedtls_mpi_core_fill_random at /home/user/esp/5.2.2/components/mbedtls/mbedtls/library/bignum_core.c:630
0x4211f40e: mbedtls_mpi_core_random at /home/user/esp/5.2.2/components/mbedtls/mbedtls/library/bignum_core.c:677
0x4211ec9f: mbedtls_mpi_random at /home/user/esp/5.2.2/components/mbedtls/mbedtls/library/bignum.c:1889
0x42122f47: mbedtls_ecp_gen_privkey_sw at /home/user/esp/5.2.2/components/mbedtls/mbedtls/library/ecp.c:3155
 (inlined by) mbedtls_ecp_gen_privkey at /home/user/esp/5.2.2/components/mbedtls/mbedtls/library/ecp.c:3181
0x42122f69: mbedtls_ecp_gen_keypair_base at /home/user/esp/5.2.2/components/mbedtls/mbedtls/library/ecp.c:3199
0x42122f9b: mbedtls_ecp_gen_keypair at /home/user/esp/5.2.2/components/mbedtls/mbedtls/library/ecp.c:3214
0x42122fc1: mbedtls_ecp_gen_key at /home/user/esp/5.2.2/components/mbedtls/mbedtls/library/ecp.c:3228
0x420672ee: chip::Crypto::P256Keypair::Initialize(chip::Crypto::ECPKeyTarget) at /home/user/Dokumente/matter/esp-matter/examples/controller/build/esp-idf/chip/../../../../../connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/src/crypto/CHIPCryptoPALmbedTLS.cpp:681
0x42097e01: chip::Controller::ExampleOperationalCredentialsIssuer::Initialize(chip::PersistentStorageDelegate&) at /home/user/Dokumente/matter/esp-matter/examples/controller/build/esp-idf/chip/../../../../../connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/src/controller/ExampleOperationalCredentialsIssuer.cpp:185
0x42012836: esp_matter::controller::example_credentials_issuer::initialize_credentials_issuer(chip::PersistentStorageDelegate&) at /home/user/Dokumente/matter/esp-matter/components/esp_matter_controller/core/esp_matter_controller_credentials_issuer.cpp:25
0x42011533: esp_matter::controller::matter_controller_client::setup_commissioner() at /home/user/Dokumente/matter/esp-matter/components/esp_matter_controller/core/esp_matter_controller_client.cpp:107
0x4200ae8c: app_main at /home/user/Dokumente/matter/esp-matter/examples/controller/main/app_main.cpp:87 (discriminator 1)
0x4215f578: main_task at /home/user/esp/5.2.2/components/freertos/app_startup.c:208
0x40381102: vPortTaskWrapper at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:134

ELF file SHA256: 85ec0c0c7

I (2682) esp_core_dump_uart: Print core dump to uart...
I (2688) esp_core_dump_common: Backing up stack @ 0x3fcbbbe0 and use core dump stack @ 0x3fca2570
I (2698) esp_core_dump_uart: Press Enter to print core dump to UART...
Initiating core dump!
Core dump started (further output muted)
Received  33 kB...
Core dump finished!
===============================================================
==================== ESP32 CORE DUMP START ====================
The ROM ELF file won't load automatically since it was not found for the provided chip type.

Crashed task handle: 0x3fcbc6c0, name: 'main', GDB name: 'process 1070319296'
Crashed task is not in the interrupt context
Panic reason: Mem alloc fail. size 0x00000018 caps 0x00000008

================== CURRENT THREAD REGISTERS ===================
exccause       0x1d (StoreProhibitedCause)
excvaddr       0x0
epc1           0x40377067
epc2           0x0
epc3           0x0
epc4           0x0
epc5           0x0
epc6           0x0
eps2           0x0
eps3           0x0
eps4           0x0
eps5           0x0
eps6           0x0
pc             0x40375b99          0x40375b99 <panic_abort+21>
lbeg           0x40056fc5          1074098117
lend           0x40056fe7          1074098151
lcount         0xffffffff          4294967295
sar            0x8                 8
ps             0x60620             394784
threadptr      <unavailable>
br             <unavailable>
scompare1      <unavailable>
acclo          <unavailable>
acchi          <unavailable>
m0             <unavailable>
m1             <unavailable>
m2             <unavailable>
m3             <unavailable>
expstate       <unavailable>
f64r_lo        <unavailable>
f64r_hi        <unavailable>
f64s           <unavailable>
fcr            <unavailable>
fsr            <unavailable>
a0             0x80380698          -2143811944
a1             0x3fcbbd60          1070316896
a2             0x3fcbbda0          1070316960
a3             0x1                 1
a4             0x9                 9
a5             0x0                 0
a6             0x3fcad30c          1070256908
a7             0x3fcb7414          1070298132
a8             0x0                 0
a9             0x1                 1
a10            0x3fcb7414          1070298132
a11            0x24                36
a12            0x20                32
a13            0x60623             394787
a14            0x0                 0
a15            0x3fcb7414          1070298132

==================== CURRENT THREAD STACK =====================
#0  0x40375b99 in panic_abort (details=0x3fcbbda0 "Mem alloc fail. size 0x00000018 caps 0x00000008") at /home/user/esp/5.2.2/components/esp_system/panic.c:466
#1  0x40380698 in esp_system_abort (details=0x3fcbbda0 "Mem alloc fail. size 0x00000018 caps 0x00000008") at /home/user/esp/5.2.2/components/esp_system/port/esp_system_chip.c:93
#2  0x4037611e in heap_caps_alloc_failed (requested_size=24, caps=8, function_name=0x3c1a6357 <__func__$2> "heap_caps_calloc") at /home/user/esp/5.2.2/components/heap/heap_caps.c:96
#3  0x40376464 in heap_caps_calloc (n=<optimized out>, size=12, caps=8) at /home/user/esp/5.2.2/components/heap/heap_caps.c:528
#4  0x421298f3 in esp_aes_process_dma (ctx=0x3fcad330 <chip::Crypto::gsEntropyContext+36>, input=0x3fcad310 <chip::Crypto::gsEntropyContext+4> "", output=0x3fcbbeb0 "\fy\313?d", len=16, stream_out=0x0) at /home/user/esp/5.2.2/components/mbedtls/port/aes/dma/esp_aes.c:393
#5  0x42129c11 in esp_aes_crypt_ecb (ctx=0x3fcad330 <chip::Crypto::gsEntropyContext+36>, mode=1, input=0x3fcad310 <chip::Crypto::gsEntropyContext+4> "", output=0x3fcbbeb0 "\fy\313?d") at /home/user/esp/5.2.2/components/mbedtls/port/aes/dma/esp_aes.c:735
#6  0x421207de in mbedtls_ctr_drbg_random_with_add (p_rng=0x3fcad310 <chip::Crypto::gsEntropyContext+4>, output=<optimized out>, output_len=32, additional=0x0, add_len=<optimized out>) at /home/user/esp/5.2.2/components/mbedtls/mbedtls/library/ctr_drbg.c:659
#7  0x4212082c in mbedtls_ctr_drbg_random (p_rng=0x3fcad310 <chip::Crypto::gsEntropyContext+4>, output=0x600ffcb8 <error: Cannot access memory at address 0x600ffcb8>, output_len=32) at /home/user/esp/5.2.2/components/mbedtls/mbedtls/library/ctr_drbg.c:708
#8  0x420671a1 in chip::Crypto::DRBG_get_bytes (out_length=32, out_buffer=0x600ffcb8 <error: Cannot access memory at address 0x600ffcb8>) at ../../../../../connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/src/crypto/CHIPCryptoPALmbedTLS.cpp:440
#9  chip::Crypto::DRBG_get_bytes (out_buffer=0x600ffcb8 <error: Cannot access memory at address 0x600ffcb8>, out_length=32) at ../../../../../connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/src/crypto/CHIPCryptoPALmbedTLS.cpp:432
#10 0x420671b4 in chip::Crypto::CryptoRNG (ctxt=0x0, out_buffer=0x600ffcb8 <error: Cannot access memory at address 0x600ffcb8>, out_length=32) at ../../../../../connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/src/crypto/CHIPCryptoPALmbedTLS.cpp:448
#11 0x4211f3c5 in mbedtls_mpi_core_fill_random (X=0x600ffcb8, X_limbs=8, n_bytes=32, f_rng=<optimized out>, p_rng=0x0) at /home/user/esp/5.2.2/components/mbedtls/mbedtls/library/bignum_core.c:630
#12 0x4211f411 in mbedtls_mpi_core_random (X=0x600ffcb8, min=1, N=0x3c1b8b68 <secp256r1_n>, limbs=8, f_rng=0x420671a8 <chip::Crypto::CryptoRNG(void*, uint8_t*, size_t)>, p_rng=0x0) at /home/user/esp/5.2.2/components/mbedtls/mbedtls/library/bignum_core.c:677
#13 0x4211eca2 in mbedtls_mpi_random (X=0x3fca9798 <esp_matter::controller::get_credentials_issuer()::s_creds_issuer+184>, min=1, N=0x3fca976c <esp_matter::controller::get_credentials_issuer()::s_creds_issuer+140>, f_rng=0x420671a8 <chip::Crypto::CryptoRNG(void*, uint8_t*, size_t)>, p_rng=0x0) at /home/user/esp/5.2.2/components/mbedtls/mbedtls/library/bignum.c:1889
#14 0x42122f4a in mbedtls_ecp_gen_privkey_sw (p_rng=0x0, f_rng=0x420671a8 <chip::Crypto::CryptoRNG(void*, uint8_t*, size_t)>, d=0x3fca9798 <esp_matter::controller::get_credentials_issuer()::s_creds_issuer+184>, N=0x3fca976c <esp_matter::controller::get_credentials_issuer()::s_creds_issuer+140>) at /home/user/esp/5.2.2/components/mbedtls/mbedtls/library/ecp.c:3155
#15 mbedtls_ecp_gen_privkey (grp=0x3fca9738 <esp_matter::controller::get_credentials_issuer()::s_creds_issuer+88>, d=0x3fca9798 <esp_matter::controller::get_credentials_issuer()::s_creds_issuer+184>, f_rng=0x420671a8 <chip::Crypto::CryptoRNG(void*, uint8_t*, size_t)>, p_rng=0x0) at /home/user/esp/5.2.2/components/mbedtls/mbedtls/library/ecp.c:3181
#16 0x42122f6c in mbedtls_ecp_gen_keypair_base (grp=0x3fca9738 <esp_matter::controller::get_credentials_issuer()::s_creds_issuer+88>, G=0x3fca9754 <esp_matter::controller::get_credentials_issuer()::s_creds_issuer+116>, d=0x3fca9798 <esp_matter::controller::get_credentials_issuer()::s_creds_issuer+184>, Q=0x3fca97a0 <esp_matter::controller::get_credentials_issuer()::s_creds_issuer+192>, f_rng=0x420671a8 <chip::Crypto::CryptoRNG(void*, uint8_t*, size_t)>, p_rng=0x0) at /home/user/esp/5.2.2/components/mbedtls/mbedtls/library/ecp.c:3199
#17 0x42122f9e in mbedtls_ecp_gen_keypair (grp=0x3fca9738 <esp_matter::controller::get_credentials_issuer()::s_creds_issuer+88>, d=0x3fca9798 <esp_matter::controller::get_credentials_issuer()::s_creds_issuer+184>, Q=0x3fca97a0 <esp_matter::controller::get_credentials_issuer()::s_creds_issuer+192>, f_rng=0x420671a8 <chip::Crypto::CryptoRNG(void*, uint8_t*, size_t)>, p_rng=0x0) at /home/user/esp/5.2.2/components/mbedtls/mbedtls/library/ecp.c:3214
#18 0x42122fc4 in mbedtls_ecp_gen_key (grp_id=<optimized out>, key=0x3fca9738 <esp_matter::controller::get_credentials_issuer()::s_creds_issuer+88>, f_rng=0x420671a8 <chip::Crypto::CryptoRNG(void*, uint8_t*, size_t)>, p_rng=0x0) at /home/user/esp/5.2.2/components/mbedtls/mbedtls/library/ecp.c:3228
#19 0x420672f1 in chip::Crypto::P256Keypair::Initialize (this=0x3fca96ec <esp_matter::controller::get_credentials_issuer()::s_creds_issuer+12>, key_target=chip::Crypto::ECPKeyTarget::ECDSA) at ../../../../../connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/src/crypto/CHIPCryptoPALmbedTLS.cpp:681
#20 0x42097e04 in chip::Controller::ExampleOperationalCredentialsIssuer::Initialize (this=0x3fca96e8 <esp_matter::controller::get_credentials_issuer()::s_creds_issuer+8>, storage=...) at ../../../../../connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/src/controller/ExampleOperationalCredentialsIssuer.cpp:185
#21 0x42012839 in esp_matter::controller::example_credentials_issuer::initialize_credentials_issuer (this=0x3fca96e0 <esp_matter::controller::get_credentials_issuer()::s_creds_issuer>, storage=...) at /home/user/Dokumente/matter/esp-matter/components/esp_matter_controller/core/esp_matter_controller_credentials_issuer.cpp:25
#22 0x42011536 in esp_matter::controller::matter_controller_client::setup_commissioner (this=0x3fca28c0 <esp_matter::controller::matter_controller_client::get_instance()::s_instance>) at /home/user/Dokumente/matter/esp-matter/components/esp_matter_controller/core/esp_matter_controller_client.cpp:107
#23 0x4200ae8f in app_main () at /home/user/Dokumente/matter/esp-matter/examples/controller/main/app_main.cpp:87
#24 0x4215f57b in main_task (args=0x0) at /home/user/esp/5.2.2/components/freertos/app_startup.c:208
#25 0x40381105 in vPortTaskWrapper (pxCode=0x4215f494 <main_task>, pvParameters=0x0) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:134

======================== THREADS INFO =========================
  Id   Target Id          Frame
* 1    process 1070319296 0x40375b99 in panic_abort (details=0x3fcbbda0 "Mem alloc fail. size 0x00000018 caps 0x00000008") at /home/user/esp/5.2.2/components/esp_system/panic.c:466
  2    process 1070321204 0x4037df6e in esp_cpu_wait_for_intr () at /home/user/esp/5.2.2/components/esp_hw_support/cpu.c:145
  3    process 1070323112 0x4037df6e in esp_cpu_wait_for_intr () at /home/user/esp/5.2.2/components/esp_hw_support/cpu.c:145
  4    process 1070378188 0x400559e0 in ?? ()
  5    process 1070301368 0x400559e0 in ?? ()
  6    process 1070363496 0x400559e0 in ?? ()
  7    process 1070552296 0x400559e0 in ?? ()
  8    process 1070373456 0x400559e0 in ?? ()
  9    process 1070503232 0x400559e0 in ?? ()
  10   process 1070390620 0x400559e0 in ?? ()
  11   process 1070342832 0x400559e0 in ?? ()
  12   process 1070307708 0x400559e0 in ?? ()
  13   process 1070303020 0x400559e0 in ?? ()

       TCB             NAME PRIO C/B  STACK USED/FREE
---------- ---------------- -------- ----------------
0x3fcbc6c0             main      1/1        2096/8640
0x3fcbce34            IDLE0      0/0          640/892
0x3fcbd5a8            IDLE1      0/0          640/888
0x3fccaccc              tiT    18/18         752/2820
0x3fcb80b8             ipc0    24/24          672/600
0x3fcc7368          console      5/5        1264/2824
0x3fcf54e8      nimble_host    21/21         768/3320
0x3fcc9a50          sys_evt    20/20         768/4080
0x3fce9540             CHIP      1/1        800/14548
0x3fccdd5c             wifi    23/23         736/5908
0x3fcc22b0     btController    23/23         736/3344
0x3fcb997c        esp_timer    22/22         672/3412
0x3fcb872c             ipc1    24/24          672/596

==================== THREAD 1 (TCB: 0x3fcbc6c0, name: 'main') =====================
#0  0x40375b99 in panic_abort (details=0x3fcbbda0 "Mem alloc fail. size 0x00000018 caps 0x00000008") at /home/user/esp/5.2.2/components/esp_system/panic.c:466
#1  0x40380698 in esp_system_abort (details=0x3fcbbda0 "Mem alloc fail. size 0x00000018 caps 0x00000008") at /home/user/esp/5.2.2/components/esp_system/port/esp_system_chip.c:93
#2  0x4037611e in heap_caps_alloc_failed (requested_size=24, caps=8, function_name=0x3c1a6357 <__func__$2> "heap_caps_calloc") at /home/user/esp/5.2.2/components/heap/heap_caps.c:96
#3  0x40376464 in heap_caps_calloc (n=<optimized out>, size=12, caps=8) at /home/user/esp/5.2.2/components/heap/heap_caps.c:528
#4  0x421298f3 in esp_aes_process_dma (ctx=0x3fcad330 <chip::Crypto::gsEntropyContext+36>, input=0x3fcad310 <chip::Crypto::gsEntropyContext+4> "", output=0x3fcbbeb0 "\fy\313?d", len=16, stream_out=0x0) at /home/user/esp/5.2.2/components/mbedtls/port/aes/dma/esp_aes.c:393
#5  0x42129c11 in esp_aes_crypt_ecb (ctx=0x3fcad330 <chip::Crypto::gsEntropyContext+36>, mode=1, input=0x3fcad310 <chip::Crypto::gsEntropyContext+4> "", output=0x3fcbbeb0 "\fy\313?d") at /home/user/esp/5.2.2/components/mbedtls/port/aes/dma/esp_aes.c:735
#6  0x421207de in mbedtls_ctr_drbg_random_with_add (p_rng=0x3fcad310 <chip::Crypto::gsEntropyContext+4>, output=<optimized out>, output_len=32, additional=0x0, add_len=<optimized out>) at /home/user/esp/5.2.2/components/mbedtls/mbedtls/library/ctr_drbg.c:659
#7  0x4212082c in mbedtls_ctr_drbg_random (p_rng=0x3fcad310 <chip::Crypto::gsEntropyContext+4>, output=0x600ffcb8 <error: Cannot access memory at address 0x600ffcb8>, output_len=32) at /home/user/esp/5.2.2/components/mbedtls/mbedtls/library/ctr_drbg.c:708
#8  0x420671a1 in chip::Crypto::DRBG_get_bytes (out_length=32, out_buffer=0x600ffcb8 <error: Cannot access memory at address 0x600ffcb8>) at ../../../../../connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/src/crypto/CHIPCryptoPALmbedTLS.cpp:440
#9  chip::Crypto::DRBG_get_bytes (out_buffer=0x600ffcb8 <error: Cannot access memory at address 0x600ffcb8>, out_length=32) at ../../../../../connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/src/crypto/CHIPCryptoPALmbedTLS.cpp:432
#10 0x420671b4 in chip::Crypto::CryptoRNG (ctxt=0x0, out_buffer=0x600ffcb8 <error: Cannot access memory at address 0x600ffcb8>, out_length=32) at ../../../../../connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/src/crypto/CHIPCryptoPALmbedTLS.cpp:448
#11 0x4211f3c5 in mbedtls_mpi_core_fill_random (X=0x600ffcb8, X_limbs=8, n_bytes=32, f_rng=<optimized out>, p_rng=0x0) at /home/user/esp/5.2.2/components/mbedtls/mbedtls/library/bignum_core.c:630
#12 0x4211f411 in mbedtls_mpi_core_random (X=0x600ffcb8, min=1, N=0x3c1b8b68 <secp256r1_n>, limbs=8, f_rng=0x420671a8 <chip::Crypto::CryptoRNG(void*, uint8_t*, size_t)>, p_rng=0x0) at /home/user/esp/5.2.2/components/mbedtls/mbedtls/library/bignum_core.c:677
#13 0x4211eca2 in mbedtls_mpi_random (X=0x3fca9798 <esp_matter::controller::get_credentials_issuer()::s_creds_issuer+184>, min=1, N=0x3fca976c <esp_matter::controller::get_credentials_issuer()::s_creds_issuer+140>, f_rng=0x420671a8 <chip::Crypto::CryptoRNG(void*, uint8_t*, size_t)>, p_rng=0x0) at /home/user/esp/5.2.2/components/mbedtls/mbedtls/library/bignum.c:1889
#14 0x42122f4a in mbedtls_ecp_gen_privkey_sw (p_rng=0x0, f_rng=0x420671a8 <chip::Crypto::CryptoRNG(void*, uint8_t*, size_t)>, d=0x3fca9798 <esp_matter::controller::get_credentials_issuer()::s_creds_issuer+184>, N=0x3fca976c <esp_matter::controller::get_credentials_issuer()::s_creds_issuer+140>) at /home/user/esp/5.2.2/components/mbedtls/mbedtls/library/ecp.c:3155
#15 mbedtls_ecp_gen_privkey (grp=0x3fca9738 <esp_matter::controller::get_credentials_issuer()::s_creds_issuer+88>, d=0x3fca9798 <esp_matter::controller::get_credentials_issuer()::s_creds_issuer+184>, f_rng=0x420671a8 <chip::Crypto::CryptoRNG(void*, uint8_t*, size_t)>, p_rng=0x0) at /home/user/esp/5.2.2/components/mbedtls/mbedtls/library/ecp.c:3181
#16 0x42122f6c in mbedtls_ecp_gen_keypair_base (grp=0x3fca9738 <esp_matter::controller::get_credentials_issuer()::s_creds_issuer+88>, G=0x3fca9754 <esp_matter::controller::get_credentials_issuer()::s_creds_issuer+116>, d=0x3fca9798 <esp_matter::controller::get_credentials_issuer()::s_creds_issuer+184>, Q=0x3fca97a0 <esp_matter::controller::get_credentials_issuer()::s_creds_issuer+192>, f_rng=0x420671a8 <chip::Crypto::CryptoRNG(void*, uint8_t*, size_t)>, p_rng=0x0) at /home/user/esp/5.2.2/components/mbedtls/mbedtls/library/ecp.c:3199
#17 0x42122f9e in mbedtls_ecp_gen_keypair (grp=0x3fca9738 <esp_matter::controller::get_credentials_issuer()::s_creds_issuer+88>, d=0x3fca9798 <esp_matter::controller::get_credentials_issuer()::s_creds_issuer+184>, Q=0x3fca97a0 <esp_matter::controller::get_credentials_issuer()::s_creds_issuer+192>, f_rng=0x420671a8 <chip::Crypto::CryptoRNG(void*, uint8_t*, size_t)>, p_rng=0x0) at /home/user/esp/5.2.2/components/mbedtls/mbedtls/library/ecp.c:3214
#18 0x42122fc4 in mbedtls_ecp_gen_key (grp_id=<optimized out>, key=0x3fca9738 <esp_matter::controller::get_credentials_issuer()::s_creds_issuer+88>, f_rng=0x420671a8 <chip::Crypto::CryptoRNG(void*, uint8_t*, size_t)>, p_rng=0x0) at /home/user/esp/5.2.2/components/mbedtls/mbedtls/library/ecp.c:3228
#19 0x420672f1 in chip::Crypto::P256Keypair::Initialize (this=0x3fca96ec <esp_matter::controller::get_credentials_issuer()::s_creds_issuer+12>, key_target=chip::Crypto::ECPKeyTarget::ECDSA) at ../../../../../connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/src/crypto/CHIPCryptoPALmbedTLS.cpp:681
#20 0x42097e04 in chip::Controller::ExampleOperationalCredentialsIssuer::Initialize (this=0x3fca96e8 <esp_matter::controller::get_credentials_issuer()::s_creds_issuer+8>, storage=...) at ../../../../../connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/src/controller/ExampleOperationalCredentialsIssuer.cpp:185
#21 0x42012839 in esp_matter::controller::example_credentials_issuer::initialize_credentials_issuer (this=0x3fca96e0 <esp_matter::controller::get_credentials_issuer()::s_creds_issuer>, storage=...) at /home/user/Dokumente/matter/esp-matter/components/esp_matter_controller/core/esp_matter_controller_credentials_issuer.cpp:25
#22 0x42011536 in esp_matter::controller::matter_controller_client::setup_commissioner (this=0x3fca28c0 <esp_matter::controller::matter_controller_client::get_instance()::s_instance>) at /home/user/Dokumente/matter/esp-matter/components/esp_matter_controller/core/esp_matter_controller_client.cpp:107
#23 0x4200ae8f in app_main () at /home/user/Dokumente/matter/esp-matter/examples/controller/main/app_main.cpp:87
#24 0x4215f57b in main_task (args=0x0) at /home/user/esp/5.2.2/components/freertos/app_startup.c:208
#25 0x40381105 in vPortTaskWrapper (pxCode=0x4215f494 <main_task>, pvParameters=0x0) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:134

==================== THREAD 2 (TCB: 0x3fcbce34, name: 'IDLE0') =====================
#0  0x4037df6e in esp_cpu_wait_for_intr () at /home/user/esp/5.2.2/components/esp_hw_support/cpu.c:145
#1  0x420040c0 in esp_vApplicationIdleHook () at /home/user/esp/5.2.2/components/esp_system/freertos_hooks.c:59
#2  0x40382102 in prvIdleTask (pvParameters=0x0) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/tasks.c:4307
#3  0x40381105 in vPortTaskWrapper (pxCode=0x4038207c <prvIdleTask>, pvParameters=0x0) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:134

==================== THREAD 3 (TCB: 0x3fcbd5a8, name: 'IDLE1') =====================
#0  0x4037df6e in esp_cpu_wait_for_intr () at /home/user/esp/5.2.2/components/esp_hw_support/cpu.c:145
#1  0x420040c0 in esp_vApplicationIdleHook () at /home/user/esp/5.2.2/components/esp_system/freertos_hooks.c:59
#2  0x40382102 in prvIdleTask (pvParameters=0x0) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/tasks.c:4307
#3  0x40381105 in vPortTaskWrapper (pxCode=0x4038207c <prvIdleTask>, pvParameters=0x0) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:134

==================== THREAD 4 (TCB: 0x3fccaccc, name: 'tiT') =====================
#0  0x400559e0 in ?? ()
#1  0x403813c4 in vPortClearInterruptMaskFromISR (prev_level=<optimized out>) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h:564
#2  vPortExitCritical (mux=0x3fcc9dc0) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:504
#3  0x40380e59 in xQueueReceive (xQueue=0x3fcc9d74, pvBuffer=0x3fccab20, xTicksToWait=<optimized out>) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/queue.c:1632
#4  0x420dfaa1 in sys_arch_mbox_fetch (mbox=0x3fcb227c <tcpip_mbox>, msg=0x3fccab20, timeout=<optimized out>) at /home/user/esp/5.2.2/components/lwip/port/freertos/sys_arch.c:317
#5  0x420d228b in tcpip_timeouts_mbox_fetch (mbox=<optimized out>, msg=<optimized out>) at /home/user/esp/5.2.2/components/lwip/lwip/src/api/tcpip.c:104
#6  tcpip_thread (arg=0x0) at /home/user/esp/5.2.2/components/lwip/lwip/src/api/tcpip.c:142
#7  0x40381105 in vPortTaskWrapper (pxCode=0x420d2204 <tcpip_thread>, pvParameters=0x0) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:134

==================== THREAD 5 (TCB: 0x3fcb80b8, name: 'ipc0') =====================
#0  0x400559e0 in ?? ()
#1  0x403813c4 in vPortClearInterruptMaskFromISR (prev_level=<optimized out>) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h:564
#2  vPortExitCritical (mux=0x3fc9bdb0 <xKernelLock>) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:504
#3  0x4038364c in xTaskGenericNotifyWait (uxIndexToWait=<optimized out>, ulBitsToClearOnEntry=<optimized out>, ulBitsToClearOnExit=4294967295, pulNotificationValue=0x3fcb7f10, xTicksToWait=4294967295) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/tasks.c:5804
#4  0x4037c284 in ipc_task (arg=<optimized out>) at /home/user/esp/5.2.2/components/esp_system/esp_ipc.c:58
#5  0x40381105 in vPortTaskWrapper (pxCode=0x4037c244 <ipc_task>, pvParameters=0x0) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:134

==================== THREAD 6 (TCB: 0x3fcc7368, name: 'console') =====================
#0  0x400559e0 in ?? ()
#1  0x403813c4 in vPortClearInterruptMaskFromISR (prev_level=<optimized out>) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h:564
#2  vPortExitCritical (mux=0x3c1c0e7c) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:504
#3  0x4037fd5a in prvReceiveGeneric (pxRingbuffer=0x3c1c0e14, pvItem1=0x3fcc6fa0, pvItem2=0x0, xItemSize1=0x3fcc6fe0, xItemSize2=0x0, xMaxSize=1, xTicksToWait=<optimized out>, xTicksToWait@entry=4294967295) at /home/user/esp/5.2.2/components/esp_ringbuf/ringbuf.c:876
#4  0x40380140 in xRingbufferReceiveUpTo (xRingbuffer=0x3c1c0e14, pxItemSize=0x3fcc6fe0, xTicksToWait=4294967295, xMaxSize=1) at /home/user/esp/5.2.2/components/esp_ringbuf/ringbuf.c:1178
#5  0x4211d1bf in uart_read_bytes (uart_num=UART_NUM_0, buf=0x3fcc7020, length=1, ticks_to_wait=4294967295) at /home/user/esp/5.2.2/components/driver/uart/uart.c:1406
#6  0x42008ca4 in uart_rx_char_via_driver (fd=0) at /home/user/esp/5.2.2/components/vfs/vfs_uart.c:194
#7  0x42008302 in uart_read_char (fd=<optimized out>) at /home/user/esp/5.2.2/components/vfs/vfs_uart.c:236
#8  0x42008e62 in uart_read (size=1, data=0x3fcc714f, fd=0) at /home/user/esp/5.2.2/components/vfs/vfs_uart.c:253
#9  uart_read (fd=0, data=0x3fcc714f, size=1) at /home/user/esp/5.2.2/components/vfs/vfs_uart.c:246
#10 0x42007db4 in console_read (fd=0, dst=0x3fcc714f, size=1) at /home/user/esp/5.2.2/components/vfs/vfs_console.c:97
#11 0x42007870 in esp_vfs_read (r=0x3fcc73c4, fd=0, dst=0x3fcc714f, size=1) at /home/user/esp/5.2.2/components/vfs/vfs.c:508
#12 0x42143f8d in read (fd=0, buf=0x3fcc714f, cnt=1) at /builds/idf/crosstool-NG/.build/xtensa-esp-elf/src/newlib/newlib/libc/syscalls/sysread.c:11
#13 0x420d0fa8 in linenoiseEdit (prompt=<optimized out>, buflen=<optimized out>, buf=0x3fcc74cc <error: Cannot access memory at address 0x3fcc74cc>) at /home/user/esp/5.2.2/components/console/linenoise/linenoise.c:884
#14 linenoiseRaw (prompt=<optimized out>, buflen=<optimized out>, buf=0x3fcc74cc <error: Cannot access memory at address 0x3fcc74cc>) at /home/user/esp/5.2.2/components/console/linenoise/linenoise.c:1104
#15 linenoise (prompt=<optimized out>) at /home/user/esp/5.2.2/components/console/linenoise/linenoise.c:1159
#16 0x420a20a1 in chip::Shell::Engine::RunMainLoop (this=0x3fcb1e28 <chip::Shell::Engine::theEngineRoot>) at ../../../../../connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/src/lib/shell/MainLoopESP32.cpp:76
#17 0x4200b724 in esp_matter::console::ChipShellTask (args=0x0) at /home/user/Dokumente/matter/esp-matter/connectedhomeip/connectedhomeip/src/lib/shell/Engine.h:76
#18 0x40381105 in vPortTaskWrapper (pxCode=0x4200b718 <esp_matter::console::ChipShellTask(void*)>, pvParameters=0x0) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:134

==================== THREAD 7 (TCB: 0x3fcf54e8, name: 'nimble_host') =====================
#0  0x400559e0 in ?? ()
#1  0x403813c4 in vPortClearInterruptMaskFromISR (prev_level=<optimized out>) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h:564
#2  vPortExitCritical (mux=0x3fcf06ac) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:504
#3  0x40380e59 in xQueueReceive (xQueue=0x3fcf0660, pvBuffer=0x3fcf5304, xTicksToWait=<optimized out>) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/queue.c:1632
#4  0x420bd9fc in npl_freertos_eventq_get (evq=0x3fcb5e3c <g_eventq_dflt>, tmo=4294967295) at /home/user/esp/5.2.2/components/bt/host/nimble/nimble/porting/npl/freertos/src/npl_os_freertos.c:282
#5  0x4037729a in ble_npl_eventq_get (evq=0x3fcb5e3c <g_eventq_dflt>, tmo=<optimized out>) at /home/user/esp/5.2.2/components/bt/host/nimble/nimble/porting/npl/freertos/include/nimble/nimble_npl_os.h:167
#6  nimble_port_run () at /home/user/esp/5.2.2/components/bt/host/nimble/nimble/porting/nimble/src/nimble_port.c:277
#7  0x42077909 in chip::DeviceLayer::Internal::BLEManagerImpl::bleprph_host_task (param=0x0) at ../../../../../connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/src/platform/ESP32/nimble/BLEManagerImpl.cpp:899
#8  0x40381105 in vPortTaskWrapper (pxCode=0x42077900 <chip::DeviceLayer::Internal::BLEManagerImpl::bleprph_host_task(void*)>, pvParameters=0x0) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:134

==================== THREAD 8 (TCB: 0x3fcc9a50, name: 'sys_evt') =====================
#0  0x400559e0 in ?? ()
#1  0x403813c4 in vPortClearInterruptMaskFromISR (prev_level=<optimized out>) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h:564
#2  vPortExitCritical (mux=0x3fcc8528) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:504
#3  0x40380e59 in xQueueReceive (xQueue=0x3fcc84dc, pvBuffer=0x3fcc9870, xTicksToWait=<optimized out>) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/queue.c:1632
#4  0x4215d394 in esp_event_loop_run (event_loop=0x3fcc62ac, ticks_to_run=4294967295) at /home/user/esp/5.2.2/components/esp_event/esp_event.c:569
#5  0x4215d3ac in esp_event_loop_run_task (args=0x3fcc62ac) at /home/user/esp/5.2.2/components/esp_event/esp_event.c:107
#6  0x40381105 in vPortTaskWrapper (pxCode=0x4215d3a0 <esp_event_loop_run_task>, pvParameters=0x3fcc62ac) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:134

==================== THREAD 9 (TCB: 0x3fce9540, name: 'CHIP') =====================
#0  0x400559e0 in ?? ()
#1  0x403813c4 in vPortClearInterruptMaskFromISR (prev_level=<optimized out>) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h:564
#2  vPortExitCritical (mux=0x3fce8860) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:504
#3  0x40380e59 in xQueueReceive (xQueue=0x3fce8814, pvBuffer=0x3fced400, xTicksToWait=<optimized out>) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/queue.c:1632
#4  0x4207734d in chip::DeviceLayer::Internal::GenericPlatformManagerImpl_FreeRTOS<chip::DeviceLayer::PlatformManagerImpl>::_RunEventLoop (this=0x3fcadd10 <chip::DeviceLayer::PlatformManagerImpl::sInstance+8>) at ../../../../../connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/src/include/platform/internal/GenericPlatformManagerImpl_FreeRTOS.ipp:251
#5  0x42077394 in chip::DeviceLayer::PlatformManager::RunEventLoop (this=0x3fcadd08 <chip::DeviceLayer::PlatformManagerImpl::sInstance>) at ../../../../../connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/src/include/platform/PlatformManager.h:403
#6  chip::DeviceLayer::Internal::GenericPlatformManagerImpl_FreeRTOS<chip::DeviceLayer::PlatformManagerImpl>::EventLoopTaskMain (arg=0x3fcadd10 <chip::DeviceLayer::PlatformManagerImpl::sInstance+8>) at ../../../../../connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/src/include/platform/internal/GenericPlatformManagerImpl_FreeRTOS.ipp:280
#7  0x40381105 in vPortTaskWrapper (pxCode=0x4207738c <chip::DeviceLayer::Internal::GenericPlatformManagerImpl_FreeRTOS<chip::DeviceLayer::PlatformManagerImpl>::EventLoopTaskMain(void*)>, pvParameters=0x3fcadd10 <chip::DeviceLayer::PlatformManagerImpl::sInstance+8>) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:134

==================== THREAD 10 (TCB: 0x3fccdd5c, name: 'wifi') =====================
#0  0x400559e0 in ?? ()
#1  0x403813c4 in vPortClearInterruptMaskFromISR (prev_level=<optimized out>) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h:564
#2  vPortExitCritical (mux=0x3fccbc90) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:504
#3  0x40380e59 in xQueueReceive (xQueue=0x3fccbc44, pvBuffer=0x3fccdbb0, xTicksToWait=<optimized out>) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/queue.c:1632
#4  0x4215f24c in queue_recv_wrapper (queue=0x3fccbc44, item=0x3fccdbb0, block_time_tick=4294967295) at /home/user/esp/5.2.2/components/esp_wifi/esp32s3/esp_adapter.c:314
#5  0x403884ac in ppTask ()
#6  0x40381105 in vPortTaskWrapper (pxCode=0x40388480 <ppTask>, pvParameters=0x0) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:134

==================== THREAD 11 (TCB: 0x3fcc22b0, name: 'btController') =====================
#0  0x400559e0 in ?? ()
#1  0x403813c4 in vPortClearInterruptMaskFromISR (prev_level=<optimized out>) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h:564
#2  vPortExitCritical (mux=0x3fcc1210) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:504
#3  0x40380f41 in xQueueSemaphoreTake (xQueue=0x3fcc11c4, xTicksToWait=<optimized out>) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/queue.c:1853
#4  0x420b4bd2 in semphr_take_wrapper (semphr=0x3fcc11b0, block_time_ms=<optimized out>) at /home/user/esp/5.2.2/components/bt/controller/esp32c3/bt.c:571
#5  0x40377610 in btdm_controller_task ()
#6  0x40381105 in vPortTaskWrapper (pxCode=0x40377498 <btdm_controller_task>, pvParameters=0x0) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:134

==================== THREAD 12 (TCB: 0x3fcb997c, name: 'esp_timer') =====================
#0  0x400559e0 in ?? ()
#1  0x403813c4 in vPortClearInterruptMaskFromISR (prev_level=<optimized out>) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h:564
#2  vPortExitCritical (mux=0x3fc9bdb0 <xKernelLock>) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:504
#3  0x40383579 in ulTaskGenericNotifyTake (uxIndexToWait=0, xClearCountOnExit=1, xTicksToWait=4294967295) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/tasks.c:5719
#4  0x42006f9c in timer_task (arg=<optimized out>) at /home/user/esp/5.2.2/components/esp_timer/src/esp_timer.c:477
#5  0x40381105 in vPortTaskWrapper (pxCode=0x42006f8c <timer_task>, pvParameters=0x0) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:134

==================== THREAD 13 (TCB: 0x3fcb872c, name: 'ipc1') =====================
#0  0x400559e0 in ?? ()
#1  0x403813c4 in vPortClearInterruptMaskFromISR (prev_level=<optimized out>) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h:564
#2  vPortExitCritical (mux=0x3fc9bdb0 <xKernelLock>) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:504
#3  0x4038364c in xTaskGenericNotifyWait (uxIndexToWait=<optimized out>, ulBitsToClearOnEntry=<optimized out>, ulBitsToClearOnExit=4294967295, pulNotificationValue=0x3fcb8580, xTicksToWait=4294967295) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/tasks.c:5804
#4  0x4037c284 in ipc_task (arg=<optimized out>) at /home/user/esp/5.2.2/components/esp_system/esp_ipc.c:58
#5  0x40381105 in vPortTaskWrapper (pxCode=0x4037c244 <ipc_task>, pvParameters=0x1) at /home/user/esp/5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:134

======================= ALL MEMORY REGIONS ========================
Name   Address   Size   Attrs
.rtc.force_fast 0x600fe010 0x0 RW
.rtc_noinit 0x50000000 0x0 RW
.rtc.force_slow 0x50000000 0x0 RW
.iram0.vectors 0x40374000 0x403 R XA
.iram0.text 0x40374404 0x178bf R XA
.dram0.data 0x3fc9bd00 0x5934 RW A
.flash.text 0x42000020 0x1604d3 R XA
.flash.appdesc 0x3c170020 0x100 R  A
.flash.rodata 0x3c170120 0x4fcb0 RW A
.ext_ram.bss 0x3c1c0000 0x0 RW
.iram0.data 0x4038bd00 0x0 RW
.iram0.bss 0x4038bd00 0x0 RW
.dram0.heap_start 0x3fcb7000 0x0 RW
.coredump.tasks.data 0x3fcbc6c0 0x154 RW
.coredump.tasks.data 0x3fcbbca0 0xa00 RW
.coredump.tasks.data 0x3fcbce34 0x154 RW
.coredump.tasks.data 0x3fcbcba0 0x280 RW
.coredump.tasks.data 0x3fcbd5a8 0x154 RW
.coredump.tasks.data 0x3fcbd310 0x280 RW
.coredump.tasks.data 0x3fccaccc 0x154 RW
.coredump.tasks.data 0x3fcca9c0 0x2f0 RW
.coredump.tasks.data 0x3fcb80b8 0x154 RW
.coredump.tasks.data 0x3fcb7e00 0x2a0 RW
.coredump.tasks.data 0x3fcc7368 0x154 RW
.coredump.tasks.data 0x3fcc6e60 0x4f0 RW
.coredump.tasks.data 0x3fcf54e8 0x154 RW
.coredump.tasks.data 0x3fcf51d0 0x300 RW
.coredump.tasks.data 0x3fcc9a50 0x154 RW
.coredump.tasks.data 0x3fcc9730 0x300 RW
.coredump.tasks.data 0x3fce9540 0x154 RW
.coredump.tasks.data 0x3fced2d0 0x320 RW
.coredump.tasks.data 0x3fccdd5c 0x154 RW
.coredump.tasks.data 0x3fccda60 0x2e0 RW
.coredump.tasks.data 0x3fcc22b0 0x154 RW
.coredump.tasks.data 0x3fcc1fb0 0x2e0 RW
.coredump.tasks.data 0x3fcb997c 0x154 RW
.coredump.tasks.data 0x3fcb96c0 0x2a0 RW
.coredump.tasks.data 0x3fcb872c 0x154 RW
.coredump.tasks.data 0x3fcb8470 0x2a0 RW

===================== ESP32 CORE DUMP END =====================
===============================================================
Done!
Coredump checksum='afd4e86c'
I (5764) esp_core_dump_common: Core dump used 864 bytes on stack. 1272 bytes left free.
I (5772) esp_core_dump_common: Restoring stack @ 0x3fcbbbe0
I (5779) esp_core_dump_uart: Core dump has been written to uart.
CPU halted.

More Information.

I'm not sure if this is an IDF, esp-matter or CHIP related bug, but I think it belongs here as it only involves IDF build settings and occurs in IDF code.

mphe commented 2 months ago

As always, 30 minutes later I realize I'm dumb. It apparently is indeed a memory issue. Memory is running low and the right combination of build settings bumps the usage up just far enough to make allocation unreliable. Depending on where I put my log statements, it fails at another point.