evcc-io / evcc

Sonne tanken ☀️🚘
https://evcc.io
MIT License
3.48k stars 642 forks source link

[OCPP] panic: runtime error: invalid memory address or nil pointer dereference #16012

Closed etecprojekt closed 1 month ago

etecprojekt commented 1 month ago

Describe the bug

Wenn ein Ladevorgang aktiv ist und die Wallbox neugestartet wird, wird eine Panic ausgelöst und EVCC crasht.

Steps to reproduce

  1. EVCC läuft
  2. Wallbox wird neugestartet
  3. EVCC crasht und startet neu

Log details

[lp-2  ] DEBUG 2024/09/10 10:12:22 charge currents: [0 0 0]A
[lp-3  ] DEBUG 2024/09/10 10:12:22 charge power: 0W
[lp-3  ] DEBUG 2024/09/10 10:12:22 charge currents: [0 0 0]A
[lp-2  ] DEBUG 2024/09/10 10:12:22 set charge mode: pv
[lp-4  ] ERROR 2024/09/10 10:12:23 charge power: timeout
[lp-4  ] ERROR 2024/09/10 10:12:23 charge currents: timeout
[circuit-wallboxen] DEBUG 2024/09/10 10:12:23 power: 11017W
[circuit-wallboxen] DEBUG 2024/09/10 10:12:23 current: 15.9A
[circuit-main] DEBUG 2024/09/10 10:12:23 power: -4629W
[circuit-main] DEBUG 2024/09/10 10:12:23 current: -6.49A
[site  ] DEBUG 2024/09/10 10:12:23 pv power: 5633W
[site  ] DEBUG 2024/09/10 10:12:23 grid meter: -4629W
[site  ] DEBUG 2024/09/10 10:12:23 grid currents: [-6.49 -6.82 -6.84]A
[site  ] DEBUG 2024/09/10 10:12:23 site power: -4629W
[lp-4  ] ERROR 2024/09/10 10:12:23 charge voltages: timeout
[lp-4  ] DEBUG 2024/09/10 10:12:23 !! session: chargeRater.chargedEnergy=4.9 - chargedAtStartup=0.0
[lp-4  ] ERROR 2024/09/10 10:12:23 charge total import: timeout
[lp-4  ] DEBUG 2024/09/10 10:12:23 charger status: B
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x1855a80]

goroutine 54 [running]:
github.com/evcc-io/evcc/charger/ocpp.(*CS).GetCompositeScheduleRequest.func1(0x30?, {0x3866ce0, 0xc001176cc0})
    github.com/evcc-io/evcc/charger/ocpp/cs_core.go:80 +0xc0
github.com/lorenzodonini/ocpp-go/ocpp1%2e6.(*centralSystem).GetCompositeSchedule.func1({0x0?, 0x0?}, {0x3866ce0?, 0xc001176cc0?})
    github.com/lorenzodonini/ocpp-go@v0.18.0/ocpp1.6/central_system.go:335 +0x54
github.com/lorenzodonini/ocpp-go/ocpp1%2e6.(*centralSystem).SetChargePointDisconnectedHandler.func1({0x387be90, 0xc000be3040})
    github.com/lorenzodonini/ocpp-go@v0.18.0/ocpp1.6/central_system.go:379 +0xb4
github.com/lorenzodonini/ocpp-go/ocppj.(*Server).onClientDisconnected(0xc00106ea20, {0x387be90, 0xc000be3040})
    github.com/lorenzodonini/ocpp-go@v0.18.0/ocppj/server.go:334 +0x9f
github.com/lorenzodonini/ocpp-go/ws.(*Server).cleanupConnection(0xc0010b20f0, 0xc000be3040)
    github.com/lorenzodonini/ocpp-go@v0.18.0/ws/websocket.go:673 +0x13e
github.com/lorenzodonini/ocpp-go/ws.(*Server).writePump(0xc0010b20f0, 0xc000be3040)
    github.com/lorenzodonini/ocpp-go@v0.18.0/ws/websocket.go:655 +0xce5
created by github.com/lorenzodonini/ocpp-go/ws.(*Server).wsHandler in goroutine 27
    github.com/lorenzodonini/ocpp-go@v0.18.0/ws/websocket.go:556 +0xc9f
[main  ] INFO 2024/09/10 10:12:49 evcc 0.130.8 (89fb334b)
[main  ] INFO 2024/09/10 10:12:49 using config file: /etc/evcc.yaml
[db    ] INFO 2024/09/10 10:12:49 using sqlite database: /root/.evcc/evcc.db
[main  ] INFO 2024/09/10 10:12:50 listening at :7070
[ABL_3W226305065-1] DEBUG 2024/09/10 10:12:50 waiting for chargepoint: 5m0s
[ABL_3W226305065-2] DEBUG 2024/09/10 10:12:50 failed triggering StatusNotification: cannot send request 3808552360, no client ABL_3W226305065 exists

What type of operating system are you running?

Docker

Nightly build

Version

evcc 0.130.8 (89fb334b)

andig commented 1 month ago

charger/ocpp/cs_core.go:80

I'm sure this line cannot crash anymore. Are you sure you are running the nightly version as you think? Could you please add the first 10 log lines after restart?

etecprojekt commented 1 month ago

I re-pull the docker image and the error is gone!