Addressable LED light custom lambda effect causing ESP32 reset

Hi, I have a pretty simple lambda effect that works for about 2 hours and then the ESP32 crashes and reboots. That only happens when this effect is running.

light:
  - platform: esp32_rmt_led_strip    
    name: Led Strip
    id: led_strip
    pin: "${ALEDs_1_PIN}"
    power_supply: power_supply_v5
    num_leds: ${LED_Count} #573
    channel_colors: GRB
    chipset: WS2812 #SK6812
    default_transition_length: 0s
    restore_mode: ALWAYS_OFF
    internal: false
    max_refresh_rate: 100ms
    color_correct: [66%, 66%, 61%]
    effects:
      - addressable_lambda:
          name: My Random Effect
          update_interval: 250ms
          lambda: |-                        
            id(led_strip_display).set_enabled(false);    
  
            for (int i = it.size() - 1; i > 1; i--) {
              it[i] = Color::random_color();
            }

I can’t see how this simple loop would cause the ESP32 to crash. It’s like it’s running out of memory or something like that but I don’t see how.
Any suggestions welcomed.
Thanks, Ant

[Device Builder 1.14.9][ESPHome 2026.9.1]

Do you have sufficient power supply for this setup? What is led_strip_display?

Yes, It’s a 20amp 5v power supply. Running this effect it’s drawing about 3amps max.
[edit] I’ve tested this without the LED strip even connected and the ESP32 still crashes after about the same time.

There is a display setup to use the same LEDs, which is why it needs the disable in the effect lambda. It switches between the two ‘modes’ using this strip just fine.

display:
  - platform: addressable_light
    id: led_strip_display
    addressable_light_id: ghell_led_strip
    width: ${LED_Count}
    height: 1 
    update_interval: 100ms
    show_test_card: false
    auto_clear_enabled: true
    lambda: |-
      for( int i=0; i<id(${LED_Count}); ++i ) {
        it.draw_pixel_at(i,0,Color(id(displayBuf)[i][0],id(displayBuf)[i][1],id(displayBuf)[i][2]));
      }

Is that 2hours to crash constant ?

I admit I’ve not timed it exactly, but yes about 2 hours with the 250ms update interval. I had that set to 100ms at first and then the crash was within about 45mins. That’s what makes it feel like it’s something to do with the loop.

Add the example code from here to get more info: