evcc-io / evcc

Sonne tanken β˜€οΈπŸš˜
https://evcc.io
MIT License
3.09k stars 561 forks source link

Version 0.124.6 or 0.124.5 is crashing with panicUnaligned() error in github.com/mabunixda/wattpilot@v1.6.5/wattpilot.go #12640

Closed kad49007 closed 6 months ago

kad49007 commented 6 months ago

Describe the bug

Version 0.124.6 or 0.124.5 is crashing with panicUnaligned() error in github.com/mabunixda/wattpilot@v1.6.5/wattpilot.go on Raspberry Pi 4 with Kernel Linux 6.1.21-v8+

Most likely because of new version of mabunixda/wattpilot@v1.6.5 is linked into Version 0.124.6 and 0.124.5. 0.124.4 is running without problems with mabunixda/wattpilot@v1.6.3 which.

Steps to reproduce

  1. Upgrade from 0.124.4 to 0.124.5 or 0.124.6
  2. Start evcc
  3. After a few second evcc is crashing ...

Configuration details

# open evcc at http://evcc.local:7070
network:
  schema: http
  host: evcc.local # .local suffix announces the hostname on MDNS
  port: 7070

log: debug
levels:
  cache: debug
  mini: debug
  site: trace
  lp-1: trace
  lp-2: trace
  eMini: trace
  e-Tron: trace
  charger: trace
  aux: trace

# unique installation id
plant: c3e77ab967105b1ccae8945ecccde2e3987556b17683360aa09957f8cdd84b27

interval: 30s # control cycle interval

meters:
- type: template
  template: fronius-solarapi-v1 
  usage: grid  
  host: 192.168.4.67  
  name: grid1
- type: template
  template: fronius-solarapi-v1
  usage: pv
  host: 192.168.4.15
  name: pv
- type: template
  template: fronius-solarapi-v1 
  usage: pv  
  host: 192.168.4.67  
  name: pv2
- type: template
  template: fronius-solarapi-v1 
  usage: battery  
  host: 192.168.4.67  
  name: battery3
  user: customer
  password: XXX
  capacity: 19.3

- type: custom
  name: Heizstab
  power: 
    source: http

    uri: http://192.168.4.67/solar_api/v1/GetPowerFlowRealtimeData.fcgi
    jq: if .Body.Data.Smartloads.Ohmpilots."0".P_AC_Total == null then 0 else .Body.Data.Smartloads.Ohmpilots."0".P_AC_Total * -1 end
  soc:
    source: http
    uri: http://192.168.4.67/solar_api/v1/GetPowerFlowRealtimeData.fcgi
    jq: if .Body.Data.Smartloads.Ohmpilots."0".Temperature == null then 0 else .Body.Data.Smartloads.Ohmpilots."0".Temperature end

chargers:
- type: template
  template: fronius-wattpilot 
  host: 192.168.4.101  
  password: XXX  
  name: wallbox2

- type: template
  template: fronius-wattpilot 
  host: 192.168.4.61  
  password: XXX  
  name: wallbox1

vehicles:
- type: template
  template: mini 
  title: eMini
  user: XXX
  password: XXX
  vin: XXX 
  capacity: 29  
  phases: 3  
  icon: car  
  cache: 15m  
  mode: PV 
  minCurrent: 6  
  maxCurrent: 16  
  name: emini

- type: template
  template: audi 
  title: e-Tron
  user: XXX
  password: XXX  
  vin: XXX 
  capacity: 100  
  phases: 3  
  icon: car  
  cache: 15m  
  mode: PV 
  minCurrent: 6  
  maxCurrent: 16  
  name: e-Tron

loadpoints:
- title: Wattpilot 2
  charger: wallbox2
  vehicle: emini
  mode: pv
  priority: 1
  #mincurrent: 6
  #maxcurrent: 16
  soc:
    poll:
      mode: connected
      interval: 15m
    estimate: true
  disable:
    delay: 2m
- title: Wattpilot 1
  charger: wallbox1
  mode: pv
  priority: 0
  soc:
    poll:
      mode: connected
      interval: 15m
    estimate: true
  disable:
    delay: 2m

site:
  title: Neufahrn
  meters:
    grid: grid1
    pv:
    - pv
    - pv2
    battery:
    - battery3
    aux:
    - Heizstab
  residualPower: 100
  #bufferSoc: 80
  #prioritySoc: 75

tariffs:
  currency: EUR # (default EUR)
  grid:
    # static grid price
    type: fixed
    price: 0.3652 # [currency]/kWh
   # type: awattar
   # cheap: 0.2 # [currency]/kWh
   # region: de

  feedin:
    # rate for feeding excess (pv) energy to the grid
    type: fixed
    price: 0.0606 # [currency]/kWh

  co2:
    type: grΓΌnstromindex  
    zip: XXX 

sponsortoken: XXX

Log details

Mar 03 17:48:01 openhabian systemd[1]: Started evcc.
Mar 03 17:48:01 openhabian evcc[9865]: [main  ] INFO 2024/03/03 17:48:01 evcc 0.124.5
Mar 03 17:48:01 openhabian evcc[9865]: [main  ] INFO 2024/03/03 17:48:01 using config file: /home/openhabian/evcc.yaml
Mar 03 17:48:01 openhabian evcc[9865]: [main  ] INFO 2024/03/03 17:48:01 starting ui and api at :7070
Mar 03 17:48:01 openhabian evcc[9865]: [db    ] INFO 2024/03/03 17:48:01 using sqlite database: /var/lib/evcc/evcc.db
Mar 03 17:48:07 openhabian evcc[9865]: [main  ] ERROR 2024/03/03 17:48:07 creating vehicle emini failed: cannot create vehicle type 'template': cannot create vehicle type 'mini': cannot get vehicles: unexpected status: 403 (Forbidden)
Mar 03 17:48:09 openhabian evcc[9865]: [lp-1  ] WARN 2024/03/03 17:48:09 poll mode '{connected 15m0s}' may deplete your battery or lead to API misuse. USE AT YOUR OWN RISK.
Mar 03 17:48:09 openhabian evcc[9865]: [lp-2  ] WARN 2024/03/03 17:48:09 poll mode '{connected 15m0s}' may deplete your battery or lead to API misuse. USE AT YOUR OWN RISK.
Mar 03 17:48:09 openhabian evcc[9865]: [site  ] WARN 2024/03/03 17:48:09 vehicle 'eMini (offline)' does not support automatic detection
Mar 03 17:48:09 openhabian evcc[9865]: [site  ] INFO 2024/03/03 17:48:09 site config:
Mar 03 17:48:09 openhabian evcc[9865]: [site  ] INFO 2024/03/03 17:48:09   meters:      grid βœ“ pv βœ“ battery βœ“
Mar 03 17:48:09 openhabian evcc[9865]: [site  ] INFO 2024/03/03 17:48:09     grid:      power βœ“ energy βœ— currents βœ—
Mar 03 17:48:09 openhabian evcc[9865]: [site  ] INFO 2024/03/03 17:48:09     pv 1:      power βœ“ energy βœ— currents βœ—
Mar 03 17:48:09 openhabian evcc[9865]: [site  ] INFO 2024/03/03 17:48:09     pv 2:      power βœ“ energy βœ— currents βœ—
Mar 03 17:48:09 openhabian evcc[9865]: [site  ] INFO 2024/03/03 17:48:09     battery 1: power βœ“ energy βœ— currents βœ— soc βœ“ capacity βœ“
Mar 03 17:48:09 openhabian evcc[9865]: [site  ] INFO 2024/03/03 17:48:09   vehicles:
Mar 03 17:48:09 openhabian evcc[9865]: [site  ] INFO 2024/03/03 17:48:09     vehicle 1: range βœ“ finish βœ“ status βœ“ climate βœ“ wakeup βœ“
Mar 03 17:48:09 openhabian evcc[9865]: [site  ] INFO 2024/03/03 17:48:09     vehicle 2: range βœ— finish βœ— status βœ— climate βœ— wakeup βœ—
Mar 03 17:48:09 openhabian evcc[9865]: [lp-1  ] INFO 2024/03/03 17:48:09 loadpoint 1:
Mar 03 17:48:09 openhabian evcc[9865]: [lp-1  ] INFO 2024/03/03 17:48:09   mode:        pv
Mar 03 17:48:09 openhabian evcc[9865]: [lp-1  ] INFO 2024/03/03 17:48:09   charger:     power βœ“ energy βœ— currents βœ“ phases βœ“ wakeup βœ—
Mar 03 17:48:09 openhabian evcc[9865]: [lp-1  ] INFO 2024/03/03 17:48:09   meters:      charge βœ“
Mar 03 17:48:09 openhabian evcc[9865]: [lp-1  ] INFO 2024/03/03 17:48:09     charge:    power βœ“ energy βœ— currents βœ“
Mar 03 17:48:09 openhabian evcc[9865]: [lp-2  ] INFO 2024/03/03 17:48:09 loadpoint 2:
Mar 03 17:48:09 openhabian evcc[9865]: [lp-2  ] INFO 2024/03/03 17:48:09   mode:        pv
Mar 03 17:48:09 openhabian evcc[9865]: [lp-2  ] INFO 2024/03/03 17:48:09   charger:     power βœ“ energy βœ— currents βœ“ phases βœ“ wakeup βœ—
Mar 03 17:48:09 openhabian evcc[9865]: [lp-2  ] INFO 2024/03/03 17:48:09   meters:      charge βœ“
Mar 03 17:48:09 openhabian evcc[9865]: [lp-2  ] INFO 2024/03/03 17:48:09     charge:    power βœ“ energy βœ— currents βœ“
Mar 03 17:48:09 openhabian evcc[9865]: [site  ] DEBUG 2024/03/03 17:48:09 set buffer soc: 95
Mar 03 17:48:09 openhabian evcc[9865]: [site  ] DEBUG 2024/03/03 17:48:09 set priority soc: 50
Mar 03 17:48:09 openhabian evcc[9865]: [site  ] DEBUG 2024/03/03 17:48:09 set battery discharge control: true
Mar 03 17:48:09 openhabian evcc[9865]: [lp-1  ] DEBUG 2024/03/03 17:48:09 phase timer inactive
Mar 03 17:48:09 openhabian evcc[9865]: [lp-1  ] DEBUG 2024/03/03 17:48:09 pv timer inactive
Mar 03 17:48:09 openhabian evcc[9865]: [lp-1  ] INFO 2024/03/03 17:48:09 vehicle updated: unknown -> eMini (offline)
Mar 03 17:48:09 openhabian evcc[9865]: [lp-2  ] DEBUG 2024/03/03 17:48:09 phase timer inactive
Mar 03 17:48:09 openhabian evcc[9865]: [lp-2  ] DEBUG 2024/03/03 17:48:09 pv timer inactive
Mar 03 17:48:09 openhabian evcc[9865]: [site  ] DEBUG 2024/03/03 17:48:09 ----
Mar 03 17:48:09 openhabian evcc[9865]: [lp-1  ] DEBUG 2024/03/03 17:48:09 charge power: 0W
Mar 03 17:48:09 openhabian evcc[9865]: [lp-2  ] DEBUG 2024/03/03 17:48:09 charge power: 0W
Mar 03 17:48:09 openhabian evcc[9865]: [site  ] DEBUG 2024/03/03 17:48:09 pv power: 162W
Mar 03 17:48:09 openhabian evcc[9865]: [site  ] DEBUG 2024/03/03 17:48:09 battery soc: 95%
Mar 03 17:48:09 openhabian evcc[9865]: [site  ] DEBUG 2024/03/03 17:48:09 battery power: 245W
Mar 03 17:48:10 openhabian evcc[9865]: [site  ] DEBUG 2024/03/03 17:48:10 grid meter: -7W
Mar 03 17:48:10 openhabian evcc[9865]: [main  ] INFO 2024/03/03 17:48:10 new version available: 0.124.6
Mar 03 17:48:10 openhabian evcc[9865]: [site  ] DEBUG 2024/03/03 17:48:10 aux power 1: -0W
Mar 03 17:48:10 openhabian evcc[9865]: [site  ] DEBUG 2024/03/03 17:48:10 aux power: 0W
Mar 03 17:48:10 openhabian evcc[9865]: [site  ] DEBUG 2024/03/03 17:48:10 site power: 338W
Mar 03 17:48:10 openhabian evcc[9865]: [lp-1  ] DEBUG 2024/03/03 17:48:10 charge currents: [0 0 0]A
Mar 03 17:48:10 openhabian evcc[9865]: [lp-1  ] DEBUG 2024/03/03 17:48:10 charger status: A
Mar 03 17:48:10 openhabian evcc[9865]: [lp-1  ] INFO 2024/03/03 17:48:10 car disconnected
Mar 03 17:48:10 openhabian evcc[9865]: [lp-1  ] DEBUG 2024/03/03 17:48:10 set session soc limit: 0
Mar 03 17:48:10 openhabian evcc[9865]: [lp-1  ] DEBUG 2024/03/03 17:48:10 set session energy limit: 0
Mar 03 17:48:10 openhabian evcc[9865]: [site  ] DEBUG 2024/03/03 17:48:10 set battery mode: normal
Mar 03 17:48:32 openhabian evcc[9865]: panic: unaligned 64-bit atomic operation
Mar 03 17:48:32 openhabian evcc[9865]: goroutine 1423 [running]:
Mar 03 17:48:32 openhabian evcc[9865]: runtime/internal/atomic.panicUnaligned()
Mar 03 17:48:32 openhabian evcc[9865]:  runtime/internal/atomic/unaligned.go:8 +0x24
Mar 03 17:48:32 openhabian evcc[9865]: runtime/internal/atomic.Xadd64(0x619160c, 0x1)
Mar 03 17:48:32 openhabian evcc[9865]:  runtime/internal/atomic/atomic_arm.s:263 +0x14
Mar 03 17:48:32 openhabian evcc[9865]: github.com/mabunixda/wattpilot.(*Wattpilot).getRequestId(...)
Mar 03 17:48:32 openhabian evcc[9865]:  github.com/mabunixda/wattpilot@v1.6.5/wattpilot.go:174
Mar 03 17:48:32 openhabian evcc[9865]: github.com/mabunixda/wattpilot.(*Wattpilot).RequestStatusUpdate(0x6191608)
Mar 03 17:48:32 openhabian evcc[9865]:  github.com/mabunixda/wattpilot@v1.6.5/wattpilot.go:683 +0x90
Mar 03 17:48:32 openhabian evcc[9865]: github.com/mabunixda/wattpilot.(*Wattpilot).processLoop.func1()
Mar 03 17:48:32 openhabian evcc[9865]:  github.com/mabunixda/wattpilot@v1.6.5/wattpilot.go:429 +0x3c
Mar 03 17:48:32 openhabian evcc[9865]: created by github.com/mabunixda/wattpilot.(*Wattpilot).processLoop in goroutine 47
Mar 03 17:48:32 openhabian evcc[9865]:  github.com/mabunixda/wattpilot@v1.6.5/wattpilot.go:427 +0x4a0
Mar 03 17:48:32 openhabian evcc[9865]: panic: unaligned 64-bit atomic operation
Mar 03 17:48:32 openhabian evcc[9865]: goroutine 1547 [running]:
Mar 03 17:48:32 openhabian evcc[9865]: runtime/internal/atomic.panicUnaligned()
Mar 03 17:48:32 openhabian evcc[9865]:  runtime/internal/atomic/unaligned.go:8 +0x24
Mar 03 17:48:32 openhabian evcc[9865]: runtime/internal/atomic.Xadd64(0x68224dc, 0x1)
Mar 03 17:48:32 openhabian evcc[9865]:  runtime/internal/atomic/atomic_arm.s:263 +0x14
Mar 03 17:48:32 openhabian evcc[9865]: github.com/mabunixda/wattpilot.(*Wattpilot).getRequestId(...)
Mar 03 17:48:32 openhabian evcc[9865]:  github.com/mabunixda/wattpilot@v1.6.5/wattpilot.go:174
Mar 03 17:48:32 openhabian evcc[9865]: github.com/mabunixda/wattpilot.(*Wattpilot).RequestStatusUpdate(0x68224d8)
Mar 03 17:48:32 openhabian evcc[9865]:  github.com/mabunixda/wattpilot@v1.6.5/wattpilot.go:683 +0x90
Mar 03 17:48:32 openhabian evcc[9865]: github.com/mabunixda/wattpilot.(*Wattpilot).processLoop.func1()
Mar 03 17:48:32 openhabian evcc[9865]:  github.com/mabunixda/wattpilot@v1.6.5/wattpilot.go:429 +0x3c
Mar 03 17:48:32 openhabian evcc[9865]: created by github.com/mabunixda/wattpilot.(*Wattpilot).processLoop in goroutine 65
Mar 03 17:48:32 openhabian evcc[9865]:  github.com/mabunixda/wattpilot@v1.6.5/wattpilot.go:427 +0x4a0
Mar 03 17:48:32 openhabian systemd[1]: evcc.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Mar 03 17:48:32 openhabian systemd[1]: evcc.service: Failed with result 'exit-code'.

What type of operating system are you running?

Linux

Version

0.124.6

andig commented 6 months ago

@mabunixda

Sieht aus wie https://github.com/golang/go/issues/23345. Findet

go vet

bei Dir einen Fehler? Zur Behebung musst Du vmtl.

_requestId         int64

an den Anfang des Struct stellen. Keine Ahnung, warum der Compiler das nicht macht- im Zweifel Issue bei Go auf machen.

mabunixda commented 6 months ago

Nein go vet liefert nichts - das lauft bei mir automatisch im pre-commit hook

PR ist erstellt #12648 basieren auf wattpilot#35

kad49007 commented 5 months ago

@mabunixda Der beschriebene Fehler ist gefixed. Mit der Zeit wird aber der Ladestroms /Status des Wattpilots nicht mehr ausgelesen. Bin daher erstmal zurΓΌck auf 0.124.4, um spΓ€ter in Ruhe diesen neuen mΓΆglichen Fehler zu analysieren.