Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] C++ Out of Memory crash (OOM) during execution #269

Open
BbMaj7 opened this issue Jan 7, 2025 · 1 comment
Open

[BUG] C++ Out of Memory crash (OOM) during execution #269

BbMaj7 opened this issue Jan 7, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@BbMaj7
Copy link

BbMaj7 commented Jan 7, 2025

C++ Out of Memory crash (OOM) during execution

Describe the bug

Compilation completes successfully. But after uploading and running the application crashes with a C++ OOM exception (see under logs). ESPHome action commands fail to execute. After boot animation, display turns black. It reacts to light action commands e.g. set color and brightness, reacting very slow and sometimes not at all, though.

Additional information

  • used Hardware:
    • ESP8266MOD on D1 Mini
    • EspHoMaTriXv2 version: 2024.12.1
    • 8x32 RGB LED Matrix

Configuration

substitutions:
  name: esphome-web-f11478
  devicename: ehmtx8266
  friendly_name: LEDMatrix2
  ledpin: GPIO00
  board: d1_mini
  loglevel: DEBUG

external_components:
  - source:
      type: git
      url: https://github.com/lubeda/EspHoMaTriXv2
      ref: 2024.12.1
    refresh: 60s 
    components: [ ehmtxv2 ]   

esphome:
  name: $devicename
  comment: 8x32 RGB Display

# To have a "next url" for improv serial
web_server:
  port: 80

esp8266:
  board: $board

font:
  - file: _fonts/mateine.ttf
    id: default_font
    size: 16
    glyphs:  |-
       !"%()+*=,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz€@üöäÜÖÄß

# Enable logging
logger:
  level: $loglevel

# Enable Home Assistant API
api:

# Allow Over-The-Air updates
ota:
- platform: esphome
  password: !secret ota_password

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:

# Allow provisioning Wi-Fi via serial
improv_serial:

light:
  - platform: neopixelbus
    id: ehmtx_light
    type: GRB
    variant: WS2812
    pin: $ledpin
    num_leds: 256
    color_correct: [30%, 30%, 30%]
    name: "$devicename Light"
    restore_mode: ALWAYS_OFF
    on_turn_on:
      lambda: |-
         id(ehmtx_display)->set_enabled(false);
    on_turn_off:
       lambda: |-
         id(ehmtx_display)->set_enabled(true);

time:
  - platform: homeassistant
    id: ehmtx_time

display:
  - platform: addressable_light
    id: ehmtx_display
    addressable_light_id: ehmtx_light
    width: 32
    height: 8
    pixel_mapper: |-
      if (x % 2 == 0) {
        return (x * 8) + y;
      }
      return (x * 8) + (7 - y);
    rotation: 0°
    update_interval: 16ms
    auto_clear_enabled: true
    lambda: |-
      id(rgb8x32)->tick();
      id(rgb8x32)->draw();

sensor:
  - platform: uptime
    name: Uptime Sensor

animation:
  - id: animation_black
    file: "black.gif"

image:
  - id: image_black
    file: "black.gif"

ehmtxv2:
  id: rgb8x32
  show_seconds: true
  rainbow_interval: 32
  matrix_component: ehmtx_display
  time_component: ehmtx_time
  icons2html: false
  default_font_id: default_font
  special_font_id: default_font
  special_font_yoffset: 8
  default_font_yoffset: 8

  icons: 
    - id: inform
      lameid: 620
    - id: attention
      lameid: 555
    - id: error
      lameid: 26465
    - id: arrow_up
      lameid: 120
    - id: arrow_down
      lameid: 124
    - id: temperature_cold
      lameid: 8043
    - id: fullscreen
      file: sample8x32.gif
    - id: samplegif
      file: sample8x8.gif

Logs

Compilation

Linking .pioenvs/ehmtx8266/firmware.elf
RAM:   [======    ]  57.4% (used 47024 bytes from 81920 bytes)
Flash: [=======   ]  67.0% (used 700145 bytes from 1044464 bytes)
Building .pioenvs/ehmtx8266/firmware.bin
esp8266_copy_factory_bin([".pioenvs/ehmtx8266/firmware.bin"], [".pioenvs/ehmtx8266/firmware.elf"])
esp8266_copy_ota_bin([".pioenvs/ehmtx8266/firmware.bin"], [".pioenvs/ehmtx8266/firmware.elf"])
======================== [SUCCESS] Took 224.91 seconds ========================
INFO Successfully compiled program.

Device Log

When uploading from within home assistant, this issue is not visible in the log. Instead it keeps reconnecting and repeating the last two lines over and over:

[...]
[11:13:35][C][EHMTXv2:3143]: Replace Time and Date: Off
[11:13:56][D][api:103]: Accepted 192.168.178.40
[11:13:56][D][api.connection:1446]: Home Assistant 2025.1.0 (192.168.178.40): Connected successfully

When installing via virtual COM port using https://web.esphome.io/ the log shows the exeption:

[10:52:29][D][wifi:497]: Found networks:
[10:52:29][I][wifi:540]: - 'netty' [redacted]▂▄▆█
[10:52:29][D][wifi:542]:     Channel: 11
[10:52:29][D][wifi:543]:     RSSI: -53 dB
[10:52:29][I][wifi:313]: WiFi Connecting to 'netty'...
[10:52:30][I][wifi:617]: WiFi Connected!
[10:52:30][C][wifi:428]:   Local MAC: EC:64:C9:F1:14:78
[10:52:30][C][wifi:433]:   SSID: [redacted]
[10:52:30][C][wifi:436]:   IP Address: 192.168.178.104
[10:52:30][C][wifi:439]:   BSSID: [redacted]
[10:52:30][C][wifi:441]:   Hostname: 'ehmtx8266'
[10:52:30][C][wifi:443]:   Signal strength: -52 dB ▂▄▆█
[10:52:30][C][wifi:447]:   Channel: 11
[10:52:30][C][wifi:448]:   Subnet: 255.255.255.0
[10:52:30][C][wifi:449]:   Gateway: 192.168.178.1
[10:52:30][C][wifi:450]:   DNS1: 192.168.178.1
[10:52:30][C][wifi:451]:   DNS2: 0.0.0.0
[10:52:30][C][web_server:100]: Setting up web server...
[10:52:30][C][api:026]: Setting up Home Assistant API server...
[10:52:30][D][EHMTXv2:852]: Setting up services
[10:52:30][D][EHMTXv2:942]: Setup and running!
[10:52:30][I][app:062]: setup() finished successfully!
[10:52:30][W][component:170]: Component wifi cleared Warning flag
[10:52:30][W][component:157]: Component api set Warning flag: unspecified
[10:52:30][I][app:100]: ESPHome version 2024.12.2 compiled on Jan  7 2025, 10:45:24
[10:52:30][C][wifi:600]: WiFi:
[10:52:30][C][wifi:428]:   Local MAC: EC:11:C9:F1:14:13
[10:52:30][C][wifi:433]:   SSID: [redacted]
[10:52:30][C][wifi:436]:   IP Address: 192.168.178.104
[10:52:30][C][wifi:439]:   BSSID: [redacted]
[10:52:30][C][wifi:441]:   Hostname: 'ehmtx8266'
[10:52:30][C][wifi:443]:   Signal strength: -52 dB ▂▄▆█
[10:52:30][C][wifi:447]:   Channel: 11
[10:52:30][C][wifi:448]:   Subnet: 255.255.255.0
[10:52:30][C][wifi:449]:   Gateway: 192.168.178.1
[10:52:30][C][wifi:450]:   DNS1: 192.168.178.1
[10:52:30][C][wifi:451]:   DNS2: 0.0.0.0
[10:52:30][C][logger:185]: Logger:
[10:52:30][C][logger:186]:   Level: DEBUG
[10:52:30][C][logger:188]:   Log Baud Rate: 115200
[10:52:30][C][logger:189]:   Hardware UART: UART0
[10:52:30][C][light:092]: Light 'ehmtx8266 Light'
[10:52:30][C][light:094]:   Default Transition Length: 1.0s
[10:52:30][C][light:095]:   Gamma Correct: 2.80
[10:52:30][C][homeassistant.time:010]: Home Assistant Time:
[10:52:30][C][homeassistant.time:011]:   Timezone: 'CET-1CEST,M3.5.0,M10.5.0/3'
[10:52:30][C][captive_portal:089]: Captive Portal:
[10:52:30][C][web_server:153]: Web Server:
[10:52:30][C][web_server:154]:   Address: ehmtx8266.local:80
[10:52:30][C][mdns:116]: mDNS:
[10:52:30][C][mdns:117]:   Hostname: ehmtx8266
[10:52:32][C][esphome.ota:073]: Over-The-Air updates:
[10:52:32][C][esphome.ota:074]:   Address: ehmtx8266.local:8266
[10:52:32][C][esphome.ota:075]:   Version: 2
[10:52:32][C][esphome.ota:078]:   Password configured
[10:52:32][C][safe_mode:018]: Safe Mode:
[10:52:32][C][safe_mode:019]:   Boot considered successful after 60 seconds
[10:52:32][C][safe_mode:021]:   Invoke after 10 boot attempts
[10:52:32][C][safe_mode:022]:   Remain in safe mode for 300 seconds
[10:52:32][C][api:140]: API Server:
[10:52:32][C][api:141]:   Address: ehmtx8266.local:6053
[10:52:32][C][api:145]:   Using noise encryption: NO
[10:52:32][C][improv_serial:032]: Improv Serial:
[10:52:32][C][EHMTXv2:3122]: EspHoMatriXv2 version: 2024.12.3
[10:52:32][C][EHMTXv2:3123]: Icons: 3 of 90
[10:52:32][C][EHMTXv2:3124]: Clock interval: 0 s
[10:52:32][C][EHMTXv2:3125]: Date format: %d.%m.
[10:52:32][C][EHMTXv2:3126]: Time format: %H:%M
[10:52:32][C][EHMTXv2:3127]: Interval (ms) scroll: 80
[10:52:32][C][EHMTXv2:3130]: Show day of week
[10:52:32][C][EHMTXv2:3138]: Weekstart: Monday
[10:52:32][C][EHMTXv2:3139]: Weekdays: SOMODIMIDOFRSA Count: 14
[10:52:32][C][EHMTXv2:3140]: Display: On
[10:52:32][C][EHMTXv2:3141]: Night mode: Off
[10:52:32][C][EHMTXv2:3142]: Weekday accent: Off
[10:52:32][C][EHMTXv2:3143]: Replace Time and Date: Off
[10:52:34][D][api:103]: Accepted 192.168.178.40
[10:52:34][W][component:170]: Component api cleared Warning flag
[10:52:34][D][api.connection:1446]: Home Assistant 2025.1.0 (192.168.178.40): Connected successfully
[10:52:34][D][time:050]: Synchronized time: 2025-01-07 10:52:32
[10:52:34][D][EHMTXv2:1019]: time sync => start running
[10:52:35]
[10:52:35]User exception (panic/abort/assert)
--------------- CUT HERE FOR EXCEPTION DECODER ---------------

[10:52:35]Unhandled C++ exception: OOM
[10:52:35]
[10:52:35]>>>stack>>>
[10:52:35]
[10:52:35]ctx: cont
[10:52:35]sp: 3ffffcd0 end: 3fffffd0 offset: 0010
[10:52:35]3ffffce0:  3fffaacb 402621b1 00000200 4023525c  
[10:52:35]3ffffcf0:  3ffffdd0 00000100 00000010 402116b8  
[10:52:35]3ffffd00:  00000000 3fffb6dc 3fffb6dc 3ffffd68  
[10:52:35]3ffffd10:  00000001 3fffae84 00000000 3ffffd58  
[10:52:35]3ffffd20:  3ffffd68 3fffb6bc 3ffffdd0 3ffffd60  
[10:52:35]3ffffd30:  3fffa4a4 3ffffdb0 3fffa4d4 40212204  
[10:52:35]3ffffd40:  00000003 00000003 00000001 00000001  
[10:52:35]3ffffd50:  00000001 00000000 00000000 00000001  
[10:52:35]3ffffd60:  00000001 00000001 4023b92c 3ffffd74  
[10:52:35]3ffffd70:  00000001 00000067 5f746c75 746e6f66  
[10:52:35]3ffffd80:  3fffaa00 00000001 3fffaab4 40100f6c  
[10:52:35]3ffffd90:  3ffffdb0 3fffaaf4 3ffffdb0 3fff487c  
[10:52:35]3ffffda0:  3fffaa08 000003e9 3fffae64 402069b0  
[10:52:35]3ffffdb0:  4023b950 3fffa9ac 00000014 0000001e  
[10:52:35]3ffffdc0:  402975f7 006e6565 edd301fe 0fb5cb07  
[10:52:35]3ffffdd0:  3fffb5dc 3fffb6dc 3fffb6dc 40203605  
[10:52:35]3ffffde0:  00000000 00000000 3fffae64 40224a55  
[10:52:35]3ffffdf0:  3fffaa08 000003e9 3fffadcc 402020ea  
[10:52:35]3ffffe00:  b4301fe9 3ffffe50 4000050c 40236500  
[10:52:35]3ffffe10:  00062b1a b4301fe9 3ffffe50 3fff694c  
[10:52:35]3ffffe20:  3ffffe50 fffff1f0 00000010 ffffffff  
[10:52:35]3ffffe30:  4022597f 0000000b 00000010 402364c9  
[10:52:35]3ffffe40:  000016d9 00003ab0 00000000 00000000  
[10:52:35]3ffffe50:  00000000 00003ab4 f3f7ced9 0043e13a  
[10:52:35]3ffffe60:  3ffffea0 3fffa984 00000000 3fff487c  
[10:52:35]3ffffe70:  3fffaa08 3fffaa08 3fff487c 402068cc  
[10:52:35]3ffffe80:  677cf960 00000000 00000010 00000000  
[10:52:35]3ffffe90:  00000003 3fffa984 00000003 40225784  
[10:52:35]3ffffea0:  402366a8 40225150 00000000 00000001  
[10:52:35]3ffffeb0:  40225150 3fff4ac4 00000000 40232bb8  
[10:52:35]3ffffec0:  3ffffef0 3fff6262 00000000 00000000  
[10:52:35]3ffffed0:  00000000 0047707e 3fff4b7c 00000000  
[10:52:35]3ffffee0:  00000000 0000001c 3ced9168 3fff1b28  
[10:52:35]3ffffef0:  00000000 00003ab8 59db22d0 0043e527  
[10:52:35]3fffff00:  3fffdad0 3fff1b28 3fff1b28 3fff8034  
[10:52:35]3fffff10:  3fff1d08 00000001 3fff8068 4022eab8  
[10:52:35]3fffff20:  40296412 3fff44d4 00000001 4022efc0  
[10:52:35]3fffff30:  402975f7 00000003 0000001c 00000000  
[10:52:35]3fffff40:  00000000 00003ab8 68b43958 0043e539  
[10:52:35]3fffff50:  00003ab8 3fffa984 3fff1b28 3fff487c  
[10:52:35]3fffff60:  3fff7fa0 3fff487c 3fffff80 3fff487c  
[10:52:35]3fffff70:  3fff7fa0 00000002 3fff1b28 40222e7e  
[10:52:35]3fffff80:  00003ab8 3fff487c 3fff6a64 3fff1f64  
[10:52:35]3fffff90:  3fff7fa8 3fff492c 3fff1b5c 3fff1f64  
[10:52:35]3fffffa0:  3fffdad0 00000000 3fff1f38 3fff1f64  
[10:52:35]3fffffb0:  3fffdad0 00000000 3fff1f38 40235814  
[10:52:35]3fffffc0:  feefeffe feefeffe 3fffdab0 4010058d  
[10:52:35]<<<stack<<<
[10:52:35]
[10:52:35]last failed alloc call: 402116B8(512)
[10:52:35]
--------------- CUT HERE FOR EXCEPTION DECODER ---------------

[10:52:35]last failed alloc caller: 0x402116b8
[10:52:35]
[10:52:35] ets Jan  8 2013,rst cause:2, boot mode:(3,6)
[10:52:35]
[10:52:35]load 0x4010f000, len 3424, room 16 
[10:52:35]tail 0
[10:52:35]chksum 0x2e
[10:52:35]load 0x3fff20b8, len 40, room 8 
[10:52:35]tail 0
[10:52:35]chksum 0x2b
[10:52:35]csum 0x2b
[10:52:35]v000abf30
[10:52:35]~ld
[10:52:35]������g�{��'|��l��l`��c����|�;��d�o���o�d`���s�d�l����[I][logger:034]: Log initialized
[...]
@BbMaj7 BbMaj7 added the bug Something isn't working label Jan 7, 2025
@lubeda
Copy link
Owner

lubeda commented Jan 10, 2025

Hi,

your device has limited ram. more then 50% are reserved for the software
RAM: [====== ] 57.4% (used 47024 bytes from 81920 bytes)
when the system starts it needs even more.

Solution: choose a decive with more ram e.g. some esp32 devices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants