evcc icon indicating copy to clipboard operation
evcc copied to clipboard

evcc 0.303.0 is crashing "hard" periodically

Open timostr opened this issue 8 months ago • 13 comments

Describe the bug

Continues restarts of evcc in my home assistant installation

Logfile shows how error starts:

runtime: goroutine stack exceeds 1000000000-byte limit
runtime: sp=0x7f0c000380 stack=[0x7f0c000000, 0x7f2c000000]
fatal error: **stack overflow**

49686a9f_evcc_2026-03-16T10-47-19.685Z.log

Steps to reproduce

  1. Install v0.303.0 and wait for some Minutes.
  2. Have Heatpump with sgready configured?
  3. Set heatpump to PV-Mode

Configuration details

network:
  # schema is the HTTP schema
  # setting to `https` does not enable https, it only changes the way URLs are generated
  schema: https
  # host is the hostname or IP address
  # if the host name contains a `.local` suffix, the name will be announced on MDNS
  # docker: MDNS announcements don't work. host must be set to the docker host's name.
  host: casastroh.de
  # port is the listening port for UI and api
  # evcc will listen on all available interfaces
  port: 7070
interval: 30s # control cycle interval (default 30s)
# sponsor token: *****
#sponsortoken: *****
sponsortoken: *****
# telemetry enables aggregated statistics
#
# Telemetry allows collecting usage data (grid and green energy, charge power).
# Data is aggregated, no individual charging sessions are tracked. The collected,
# anonymous data can be retrieved using https://api.evcc.io.
#
# See https://github.com/evcc-io/evcc/pull/4343 or details.
#
# For time being, this is only available to sponsors, hence data is associated with
# the sponsor token's identity.
#
telemetry: true
plant: *****
# log settings (default)
log: info # info
levels:
  site: debug # debug
  lp-1: debug # debug
  lp-2: debug # debug
  cache: error # error
  db: error # error
  ocpp: error
# log settings (to report bug)
#log: trace # info
#levels:
#  site: trace # debug
#  lp-1: trace # debug
#  lp-2: debug # debug
#  cache: error # error
#  db: error # error
#  ocpp: trace
# modbus proxy for allowing external programs to reuse the evcc modbus connection
# each entry will start a proxy instance at the given port speaking Modbus TCP and
# relaying to the given modbus downstream device (either TCP or RTU, RS485 or TCP)
modbusproxy:
#  - port: 502
#    uri: *****
#    # rtu: true
#    # readonly: true
# meter definitions
# name can be freely chosen and is used as reference when assigning meters to site and loadpoints
# for documentation see https://docs.evcc.io/docs/devices/meters
meters:
  - name: grid
    type: template
    template: solaredge-hybrid
    usage: grid
    modbus: tcpip
    id: 1
    host: 192.168.188.42
    port: 502
    watchdog: 10s
  - name: pv
    type: template
    template: solaredge-hybrid
    usage: pv
    modbus: tcpip
    id: 1
    host: 192.168.188.42
    port: 502
    watchdog: 10s
  - name: my_battery
    type: template
    template: solaredge-hybrid
    usage: battery
    modbus: tcpip
    id: 1
    host: 192.168.188.42
    port: 502
    watchdog: 10s
# charger definitions
# name can be freely chosen and is used as reference when assigning charger to vehicle
# for documentation see https://docs.evcc.io/docs/devices/chargers
chargers:
  - name: SolaredgeWallbox
    type: template
    template: ocpp
    idtag: *****
    stationid: *****
    connector: 1
  - name: BoschHeatpump
    type: template
    template: emsesp
    host: ems-esp.local
    token: *****
    powersource: hpcurrpower
    tempsource: warmwater
  #- name: SolaredgeWallbox
  #  type: template
  #  template: keba-modbus
  #  modbus: tcpip
  #  id: 255
  #  host: 192.168.188.99
  #  port: 1502
  #- name: SolaredgeWallbox
  #  type: template
  #  template: keba
  #  host: 192.168.188.99
# vehicle definitions
# name can be freely chosen and is used as reference when assigning vehicle to loadpoint
# for documentation see https://docs.evcc.io/docs/devices/vehicles
vehicles:
  - name: ID5
    type: template
    template: vw
    title: ID.5
    user: *****
    password: *****
    vin: *****
    capacity: 77 # kWh
# phases: 3
# site describes the EVU connection, PV and home battery
site:
  title: Zuhause # display name for UI
  meters:
    grid: grid # grid meter
    pv:
      - pv # list of pv inverters/ meters
    battery:
      - my_battery
  #bufferSoC: 90 # ignore home battery discharge above soc (empty to disable)
  #prioritySoC: 80 # give home battery priority up to this soc (empty to disable)
  residualPower: 250
# loadpoint describes the charger, charge meter and connected vehicle
loadpoints:
  - title: Garage # display name for UI
    charger: SolaredgeWallbox # charger
    #meter: charge # charge meter
    mode: "pv" # set default charge mode, use "off" to disable by default if charger is publicly available
    vehicle: ID5 # set default vehicle (disables vehicle detection)
    soc:
      # polling defines usage of the vehicle APIs
      # Modifying the default settings it NOT recommended. It MAY deplete your vehicle's battery
      # or lead to vehicle manufacturer banning you from API use. USE AT YOUR OWN RISK.
      poll:
        # poll mode defines under which condition the vehicle API is called:
        #   charging: update vehicle ONLY when charging (this is the recommended default)
        #   connected: update vehicle when connected (not only charging), interval defines how often
        #   always: always update vehicle regardless of connection state, interval defines how often (only supported for single vehicle)
        mode: charging
        # poll interval defines how often the vehicle API may be polled if NOT charging
        interval: 60m
      estimate: true # set false to disable interpolating between api updates (not recommended)
    enable: # pv mode enable behavior
      delay: 1m # threshold must be exceeded for this long
      threshold: -2000 # grid power threshold (in Watts, negative=export). If zero, export must exceed minimum charge power to enable
    disable: # pv mode disable behavior
      delay: 3m # threshold must be exceeded for this long
      threshold: 2000 # maximum import power (W)
    # guardDuration: 5m # switch charger contactor not more often than this (default 5m)
    # minCurrent: 6 # minimum charge current (default 6A)
    # maxCurrent: 16 # maximum charge current (default 16A)
  - title: Wärmepumpe
    charger: BoschHeatpump
    mode: pv
    enable: # pv mode enable behavior
      delay: 5m # threshold must be exceeded for this long
      threshold: -1000 # grid power threshold (in Watts, negative=export). If zero, export must exceed minimum charge power to enable
    disable: # pv mode disable behavior
      delay: 20m # threshold must be exceeded for this long
      threshold: 150 # maximum import power (W)
# mqtt message broker
mqtt:
  broker: 192.168.188.42:1883
  topic: evcc # root topic for publishing, set empty to disable
  user: *****
  password: *****
# influx database
influx:
  # url: *****
  # database: evcc
  # user: *****
  # password: *****
# eebus credentials
eebus:
  # uri: *****
  # interfaces: # limit eebus to specific network interfaces
  # - en0
  # certificate: # local signed certificate, required, can be generated via `evcc eebus-cert`
  #   public: # public key
  #   private: # private key
# push messages
messaging:
  events:
    start: # charge start event
      title: Charge started
      msg: Started charging in "${mode}" mode
    stop: # charge stop event
      title: Charge finished
      msg: Finished charging ${chargedEnergy:%.1fk}kWh in ${chargeDuration}.
    connect: # vehicle connect event
      title: Car connected
      msg: "Car connected at ${pvPower:%.1fk}kW PV"
    disconnect: # vehicle connected event
      title: Car disconnected
      msg: Car disconnected after ${connectedDuration}
    soc: # vehicle soc update event
      title: Soc updated
      msg: Battery charged to ${vehicleSoc:%.0f}%
    guest: # vehicle could not be identified
      title: Unknown vehicle
      msg: Unknown vehicle, guest connected?
  services:
  # - type: pushover
  #   app: *****
  #   recipients: *****
  #   - # list of recipient ids
  # - type: telegram
  #   token: *****
  #   chats: *****
  #   - # list of chat ids
  # - type: email
  #   uri: *****
  # - type: ntfy
  #   uri: *****
  #   priority: <priority>
  #   tags: <tags>

Configuration UI:
{
  "charger": [],
  "experimental": true,
  "influx": {"url":"","database":"","token":"","org":"","user":"","password":"","insecure":false},
  "interval": 30,
  "loadpoints": [],
  "meter": [],
  "mqtt": {"broker":"192.168.188.42:1883","user":"mqtt-user","password":"***","clientID":"","insecure":false,"caCert":"","clientCert":"","clientKey":"","topic":"evcc"},
  "shm": {"vendorId":"","deviceId":"","deviceSerial":""},
  "site": {"title":"Zuhause","grid":"grid","pv":["pv"],"battery":["my_battery"],"aux":null,"ext":null},
  "tariff": [
    {"id":2,"name":"db:2","config":{"price":0.08,"template":"fixed"},"deviceProduct":"Fester Preis","type":"template"},
    {"id":5,"name":"db:5","config":{"az":275,"dec":25,"interval":"1h","kwp":8,"lat":"***","lon":"***","template":"forecast-solar"},"deviceProduct":"Forecast.Solar","deviceTitle":"Dach Westen","type":"template"},
    {"id":4,"name":"db:4","config":{"az":95,"dec":25,"interval":"1h","kwp":9,"lat":"***","lon":"***","template":"forecast-solar"},"deviceProduct":"Forecast.Solar","deviceTitle":"Dach Osten","type":"template"},
    {"id":3,"name":"db:3","config":{"template":"grünstromindex","token":"***","zip":"***"},"deviceProduct":"Grünstromindex","type":"template"},
    {"id":1,"name":"db:1","config":{"homeid":"XXXXX","template":"tibber","token":"***"},"deviceProduct":"Tibber","type":"template"}
  ],
  "tariffRefs": {"grid":"db:1","feedIn":"db:2","co2":"db:3","planner":"","solar":["db:4","db:5"]},
  "vehicle": []
}

Log details

runtime: goroutine stack exceeds 1000000000-byte limit
runtime: sp=0x7f04000380 stack=[0x7f04000000, 0x7f24000000]
fatal error: stack overflow
runtime stack:
runtime.throw({0x2799168?, 0x4de24?})
	runtime/panic.go:1229 +0x38 fp=0x7f48113e80 sp=0x7f48113e50 pc=0x97a58
runtime.newstack()
	runtime/stack.go:1178 +0x498 fp=0x7f48113fb0 sp=0x7f48113e80 pc=0x7c6c8
runtime.morestack()
	runtime/asm_arm64.s:507 +0x70 fp=0x7f48113fb0 sp=0x7f48113fb0 pc=0x9d970
goroutine 796 gp=0x7f498ac780 m=6 mp=0x7f4846d008 [running]:
fmt.(*fmt).padString(0x7f489b1700, {0x278009d, 0x6})
	fmt/format.go:111 +0x2b8 fp=0x7f04000380 sp=0x7f04000380 pc=0x128388
fmt.(*fmt).fmtS(0x0?, {0x278009d?, 0x0?})
	fmt/format.go:359 +0x40 fp=0x7f040003c0 sp=0x7f04000380 pc=0x128d80
fmt.(*pp).fmtString(0x7f04000458?, {0x278009d?, 0x0?}, 0x278009d?)
	fmt/print.go:498 +0xe4 fp=0x7f04000410 sp=0x7f040003c0 pc=0x12bc14
fmt.(*pp).printArg(0x7f489b16c0, {0x2009600, 0x2f94960}, 0x73)
	fmt/print.go:742 +0x17c fp=0x7f040004a0 sp=0x7f04000410 pc=0x12d2cc
fmt.(*pp).doPrintf(0x7f489b16c0, {0x27adb3f, 0x14}, {0x7f04000840, 0x1, 0x1})
	fmt/print.go:1075 +0x348 fp=0x7f040005a0 sp=0x7f040004a0 pc=0x12fb08
fmt.Appendf({0x7f48ab4a80, 0x2a, 0xa80}, {0x27adb3f, 0x14}, {0x7f04000840, 0x1, 0x1})
	fmt/print.go:249 +0x58 fp=0x7f04000600 sp=0x7f040005a0 pc=0x12a698
github.com/evcc-io/evcc/charger.NewSgReadyFromConfig.func1.(*Logger).Printf.2({0x7f48ab4a80?, 0x7f040008e0?, 0x7f04000688?})
	log/log.go:268 +0x2c fp=0x7f04000650 sp=0x7f04000600 pc=0x143b13c
log.(*Logger).output(0x7f48a67920, 0x0, 0x2, 0x7f04000860)
	log/log.go:237 +0x240 fp=0x7f04000800 sp=0x7f04000650 pc=0x1389a0
log.(*Logger).Printf(...)
	log/log.go:267
github.com/evcc-io/evcc/charger.NewSgReadyFromConfig.func1(0x2)
	github.com/evcc-io/evcc/charger/sgready.go:88 +0xfc fp=0x7f040008a0 sp=0x7f04000800 pc=0x143b00c
github.com/evcc-io/evcc/charger.NewSgReadyFromConfig.func1(0x2)
	github.com/evcc-io/evcc/charger/sgready.go:92 +0x174 fp=0x7f04000940 sp=0x7f040008a0 pc=0x143b084
github.com/evcc-io/evcc/charger.NewSgReadyFromConfig.func1(0x2)
	github.com/evcc-io/evcc/charger/sgready.go:92 +0x174 fp=0x7f040009e0 sp=0x7f04000940 pc=0x143b084
github.com/evcc-io/evcc/charger.NewSgReadyFromConfig.func1(0x2)
	github.com/evcc-io/evcc/charger/sgready.go:92 +0x174 fp=0x7f04000a80 sp=0x7f040009e0 pc=0x143b084
github.com/evcc-io/evcc/charger.NewSgReadyFromConfig.func1(0x2)
	github.com/evcc-io/evcc/charger/sgready.go:92 +0x174 fp=0x7f04000b20 sp=0x7f04000a80 pc=0x143b084
github.com/evcc-io/evcc/charger.NewSgReadyFromConfig.func1(0x2)
	github.com/evcc-io/evcc/charger/sgready.go:92 +0x174 fp=0x7f04000bc0 sp=0x7f04000b20 pc=0x143b084
github.com/evcc-io/evcc/charger.NewSgReadyFromConfig.func1(0x2)
	github.com/evcc-io/evcc/charger/sgready.go:92 +0x174 fp=0x7f04000c60 sp=0x7f04000bc0 pc=0x143b084
github.com/evcc-io/evcc/charger.NewSgReadyFromConfig.func1(0x2)
	github.com/evcc-io/evcc/charger/sgready.go:92 +0x174 fp=0x7f04000d00 sp=0x7f04000c60 pc=0x143b084
github.com/evcc-io/evcc/charger.NewSgReadyFromConfig.func1(0x2)
	github.com/evcc-io/evcc/charger/sgready.go:92 +0x174 fp=0x7f04000da0 sp=0x7f04000d00 pc=0x143b084
github.com/evcc-io/evcc/charger.NewSgReadyFromConfig.func1(0x2)
	github.com/evcc-io/evcc/charger/sgready.go:92 +0x174 fp=0x7f04000e40 sp=0x7f04000da0 pc=0x143b084
github.com/evcc-io/evcc/charger.NewSgReadyFromConfig.func1(0x2)
	github.com/evcc-io/evcc/charger/sgready.go:92 +0x174 fp=0x7f04000ee0 sp=0x7f04000e40 pc=0x143b084
github.com/evcc-io/evcc/charger.NewSgReadyFromConfig.func1(0x2)
...

What type of operating system or environment does evcc run on?

HomeAssistant Add-on

External automation

  • [x] I have made sure that no external automation like HomeAssistant or Node-RED is active or accessing any of the mentioned devices when this issue occurs.

Nightly build

  • [x] I have verified that the issue is reproducible with the latest nightly build

Version

v0.303.0

timostr avatar Mar 16 '26 11:03 timostr

I do recognize a CPU load of 100% of the EVCC process since this version.

MikeTheTux avatar Mar 16 '26 12:03 MikeTheTux

I’m also using a Bosch heat pump via EMS-ESP, and I’m experiencing the same issue. The bug occurs when the heat pump controller is in a charging mode and EVCC tries to activate sg_ready mode. This issue has already been reported in #28266, so this seems to be a duplicate.

If the heat pump is switched off in evcc, my instance runs stable.

tah78 avatar Mar 16 '26 12:03 tah78

I don't have a heat pump but also have the periodical crashes. I guess that's why I don't see the sg_ready entries in my log.

ScumbagSteve avatar Mar 16 '26 14:03 ScumbagSteve

Same Issue since this version in to environments...

Claas1983 avatar Mar 16 '26 15:03 Claas1983

I also have this issue with the custom sgready setup. I also noticed that evcc writes nothing to mqtt. Even when switching modes in UI, it doesn't update the mqtt topic.

    setmode: # Setzen des Betriebsmodus
      source: switch
      switch:
        - case: 1 # Betriebszustand: "Dim" (Sperr-Betrieb)
          set:
            source: mqtt
            topic: HomeAssistant/evcc/HP/mode/set
            payload: "1"
        - case: 2 # Betriebszustand: "Normal" (Normalbetrieb)
          set:
            source: mqtt
            topic: HomeAssistant/evcc/HP/mode/set
            payload: "2"
        - case: 3 # Betriebszustand: "Boost" (Anlaufempfehlung)
          set:
            source: mqtt
            topic: HomeAssistant/evcc/HP/mode/set
            payload: "3"

nrhein avatar Mar 16 '26 15:03 nrhein

I have a StiebelEltron heatpump configured and since 0.303.0 see 100% CPU consumption and even increasing memory appearing 3-4 minutes after start until killed by OOM. I'm not seeing the go runtime crash but likely that's just because containerd is killing it before.

sfudeus avatar Mar 16 '26 15:03 sfudeus

Will fix later and release…

andig avatar Mar 16 '26 16:03 andig

Refs https://github.com/golang/go/issues/78177

andig avatar Mar 16 '26 16:03 andig

All: which OS/CPU is this crashing on?

andig avatar Mar 16 '26 17:03 andig

Closed in d0a0dc52d14f4901b64713b06488497ee22090dd

andig avatar Mar 16 '26 17:03 andig

Using it in HA with an Intel Core i5 (I think 6th generation).

In my case it seems as if the configured Octopus Energy tarif with a "fixed proce" because my smart meter isn't configured completely yet and I therefore don't have the proce zones yet caused the trouble.

I replaced the tarif with a fixed price and (using the direct URL to evcc with :7070 at the ende instead of HA integrated) and it is then usable through HA again).

kshicks avatar Mar 16 '26 17:03 kshicks

Please check linked go issue. If you can confirm reproducer for other positive/negative architectures please comment there.

andig avatar Mar 16 '26 17:03 andig

@andig: RPI5 (ARM64, aarch64) with HAOS and evcc running as Home Assistant App. The bug reproduces with a Bosch heat pump via EMS-ESP when using PV/Min-PV/Fast mode.

@kshicks: I am using a fixed price tariff with two price zones, but the issue still occurs.

tah78 avatar Mar 16 '26 17:03 tah78