[Bug]: heltec-v4-tft boot-loops on internal heap exhaustion with a full NodeDB (2.8.3.f584291 develop)

Open
#12,456 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

  • #12457 by @thebentern — closed without merging

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
15/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
cpp

Research direction

Start from the boot log's MemAudit line and the NodeDB load path that reports 250 nodes, then compare the memory budget against the crash sites: ESP32CryptoEngine.cpp:33 under CryptoEngine::decrypt, and include/util/Packet.h:41 in PacketAPI::runOnce. The test fixture test/fixtures/nodedb/seed_v25_0250.jsonl, built with bin/seed-json-to-proto.py, reproduces the full NodeDB. Done means the Heltec V4 TFT stays up through boot with that NodeDB. This needs firmware memory knowledge, so it is not a starter task.

Written by the indexing model from the issue text.

Description

first-contribution
Category

Other

Hardware

Other: Heltec V4 with TFT (heltec-v4-tft, ESP32-S3, 2 MB PSRAM)

UI
  • Meshtastic UI aka MUI
Firmware Version

2.8.3.f584291 (develop CI build, run 44996413662, artifact firmware-esp32s3-heltec-v4-tft-2.8.3.f584291; device-ui fb3c069)

Description

With a full NodeDB (250 nodes), the device boot-loops 8–15 s after every boot because the internal heap is exhausted. The NodeDB was the 250-node test fixture (test/fixtures/nodedb/seed_v25_0250.jsonl, compiled with bin/seed-json-to-proto.py) uploaded to /prefs/nodes.proto. The device is a CLIENT on US/MEDIUM_FAST with 6 channels and Bluetooth disabled.

Boot log, the same on every boot:

Free heap: 201740
Loaded saved nodedatabase v25: 250 nodes, 217 pos, 165 tel, 57 env, 102 status
[DeviceUI] LVGL: allocating 57600 bytes PSRAM for draw buffer (max free PSRAM: 499700)
Free heap  :  102544 bytes
Free PSRAM :  157652 bytes
MemAudit[boot]: msgstore=4400 warm=80000 nodedb=25000 satmaps=48045 pkthist=12048 tmm=20480 tmm_ni=248000 total=437973

Three consecutive crashes, decoded against firmware-heltec-v4-tft-2.8.3.f584291.elf from the same artifact. Each is an allocation failure:

  1. abort() in lock_init_generic (mutex creation failed) ← esp_crypto_sha_aes_lock_acquire ← esp_aes_crypt_ctr ← ESP32CryptoEngine::encryptAESCtr (ESP32CryptoEngine.cpp:33) ← CryptoEngine::decrypt, while decrypting a received packet. The previous boot also logged E esp-aes: Failed to allocate memory.
  2. LoadProhibited in pthread_mutex_unlock ← _Unwind_RaiseException ← __cxa_throw ← operator new ← PacketAPI::runOnce (device-ui include/util/Packet.h:41). This is std::bad_alloc thrown while unwinding.
  3. abort() in lock_init_generic ← _lock_acquire_recursive ← uart_write ← console write ← … ← esp_aes_crypt_ctr ← ESP32CryptoEngine::encryptAESCtr ← CryptoEngine::decrypt. esp-aes's own allocation-failure log could not create the console lock.

For comparison, the same device on 2.8.2.d5f1619 (device-ui 57c7bc6) ran for days with a full real 250-node NodeDB. It later hit a separate device-ui map-marker issue (meshtastic/device-ui#505). Rolling back to 2.8.2.d5f1619 and clearing the NodeDB restored normal operation.

Relevant log output

Backtraces as printed:

abort() was called at PC 0x40376acb on core 1
Backtrace: 0x4038181d:0x3fceb750 0x403817d9:0x3fceb770 0x40385c0a:0x3fceb790 0x40376acb:0x3fceb800 0x40376afa:0x3fceb820 0x40376c05:0x3fceb850 0x421be48d:0x3fceb870 0x421d7e73:0x3fceb890 0x421d8233:0x3fceb8b0 0x42132c32:0x3fceb8e0 0x420dc2c9:0x3fceb940 0x420dbe23:0x3fceb990 0x420f47ab:0x3fceb9b0 0x420f4ae2:0x3fcebbb0 0x420f7182:0x3fcebf50 0x420e1636:0x3fcebf90 0x420b28cf:0x3fcebfb0 0x420e2cad:0x3fcebfd0 0x4213acb0:0x3fcec050

Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.
EXCVADDR: 0x00000003
Backtrace: 0x421690c2:0x3fcebde0 0x4222ee52:0x3fcebe00 0x4222e24f:0x3fcebe30 0x4222e591:0x3fcebe60 0x42210aad:0x3fcebf10 0x42210b4e:0x3fcebf30 0x420faee7:0x3fcebf50 0x420fb069:0x3fcebf90 0x420b28cf:0x3fcebfb0 0x420e2cad:0x3fcebfd0 0x4213acb0:0x3fcec050

abort() was called at PC 0x40376acb on core 1
Backtrace: 0x4038181d:0x3fceb360 0x403817d9:0x3fceb380 0x40385c0a:0x3fceb3a0 0x40376acb:0x3fceb410 0x40376afa:0x3fceb430 0x40376c15:0x3fceb460 0x4216c41a:0x3fceb480 0x421710b9:0x3fceb4b0 0x4223d292:0x3fceb4d0 0x4217077d:0x3fceb4f0 0x421710b9:0x3fceb510 0x42239862:0x3fceb530 0x42238add:0x3fceb550 0x42238b2f:0x3fceb570 0x422399e2:0x3fceb590 0x4223fb5b:0x3fceb5b0 0x4223fb7a:0x3fceb5d0 0x4223fc4a:0x3fceb5f0 0x422398d9:0x3fceb6a0 0x40385a22:0x3fceb6d0 0x42251a06:0x3fceb730 0x421dd057:0x3fceb790 0x421dd0bd:0x3fceb7b0 0x421dd1e1:0x3fceb810 0x421dd201:0x3fceb840 0x421dcf7a:0x3fceb860 0x421d8264:0x3fceb8b0 0x42132c32:0x3fceb8e0 0x420dc2c9:0x3fceb940 0x420dbe23:0x3fceb990 0x420f47ab:0x3fceb9b0 0x420f4ae2:0x3fcebbb0 0x420f7182:0x3fcebf50 0x420e1636:0x3fcebf90 0x420b28cf:0x3fcebfb0 0x420e2cad:0x3fcebfd0 0x4213acb0:0x3fcec050
Dominant language
C++
Stars
8.4k
Forks
2.8k
Avg merge
3d 14h
Merged PRs (30d)
119

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from meshtastic/firmware

All issues in meshtastic/firmware

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.