gaetancollaud / digitalstrom-mqtt

Bridge between digitalSTROM and MQTT
GNU Affero General Public License v3.0
23 stars 4 forks source link

1.6.0 segfault on startup #32

Closed holli73 closed 2 years ago

holli73 commented 2 years ago
holli@mqtt-node-red:~/BUILD/DsS-to-mqtt$ ./digitalstrom-mqtt &
[1] 14652
holli@mqtt-node-red:~/BUILD/DsS-to-mqtt$ 2022-03-30T17:58:50+02:00 INF String digitalstrom MQTT!
2022-03-30T17:58:50+02:00 INF MQTT Connected
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x74465e]

goroutine 11 [running]:
github.com/gaetancollaud/digitalstrom-mqtt/digitalstrom.(*Digitalstrom).GetAllDevices(...)
    /home/runner/work/digitalstrom-mqtt/digitalstrom-mqtt/digitalstrom/digitalstrom.go:134
github.com/gaetancollaud/digitalstrom-mqtt/digitalstrom_mqtt.(*DigitalstromMqtt).subscribeToAllDevicesCommands(0xc000067b90)
    /home/runner/work/digitalstrom-mqtt/digitalstrom-mqtt/digitalstrom_mqtt/mqtt.go:197 +0x3e
github.com/gaetancollaud/digitalstrom-mqtt/digitalstrom_mqtt.New.func1(0x86b6e8, 0xc00013a800)
    /home/runner/work/digitalstrom-mqtt/digitalstrom-mqtt/digitalstrom_mqtt/mqtt.go:70 +0x5d
created by github.com/eclipse/paho%2emqtt%2egolang.(*client).startCommsWorkers
    /home/runner/go/pkg/mod/github.com/eclipse/paho.mqtt.golang@v1.3.2/client.go:536 +0x5ac

[1]+  Exit 2                  ./digitalstrom-mqtt
holli@mqtt-node-red:~/BUILD/DsS-to-mqtt$
gaetancollaud commented 2 years ago

Thx for reporting I will have a look.

gaetancollaud commented 2 years ago

I think I found a race condition that when the MQTT server is really fast to connect and the app is a bit slow to start this could happen. Not 100% sure though.

Anyway, I fixed what I found and released 1.6.1. Please let me know if you still have the issue. But since you recently opened another ticket about the 1.6.0 with some other issues I think you were able to start it eventually.

gaetancollaud commented 2 years ago

closing because of this comment: https://github.com/gaetancollaud/digitalstrom-mqtt/issues/33#issuecomment-1084181838