segmentation fault when starting after upgrading to v0.2.0
andir opened this issue · comments
After upgrading to v0.2.0 and restarting the service fails with a segmentation fault. Even without adopting the configuration after upgrading the service should not crash this way...
From the looks of it the configuration crashes whenever an unkown module is being referenced. It logs the error but does not skip / exit / abort execution in a clean fashion:
Lines 87 to 98 in a04922c
Dec 01 16:43:16 prometheus systemd[1]: Started cpthook.service.
Dec 01 16:43:16 prometheus sqzjnjc7sim4skp8jf9ccxi78p1njyhv-unit-script-cpthook-start[6511]: time="2018-12-01T16:43:16Z" level=info msg="Loglevel not defined in configuration. Defaulting to ERROR"
Dec 01 16:43:16 prometheus sqzjnjc7sim4skp8jf9ccxi78p1njyhv-unit-script-cpthook-start[6511]: time="2018-12-01T16:43:16Z" level=error msg="found configuration for unknown module: \"status\""
Dec 01 16:43:16 prometheus sqzjnjc7sim4skp8jf9ccxi78p1njyhv-unit-script-cpthook-start[6511]: panic: runtime error: invalid memory address or nil pointer dereference
Dec 01 16:43:16 prometheus sqzjnjc7sim4skp8jf9ccxi78p1njyhv-unit-script-cpthook-start[6511]: [signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x809dbb]
Dec 01 16:43:16 prometheus sqzjnjc7sim4skp8jf9ccxi78p1njyhv-unit-script-cpthook-start[6511]: goroutine 1 [running]:
Dec 01 16:43:16 prometheus sqzjnjc7sim4skp8jf9ccxi78p1njyhv-unit-script-cpthook-start[6511]: main.main()
Dec 01 16:43:16 prometheus sqzjnjc7sim4skp8jf9ccxi78p1njyhv-unit-script-cpthook-start[6511]: /build/go/src/github.com/fleaz/CptHook/main.go:94 +0x5ab
Configuration:
http:
listen: '[::1]:8083'
irc:
host: irc.hackint.eu
nickname: nickname
port: 6667
ssl:
enabled: true
modules:
prometheus:
channel: '#channel'
enabled: true
status:
enabled: true
The example configuration should also be changed. At least the status
module must be removed.
Lines 22 to 24 in a04922c
This was already fixed in 'development' but I forgot to release a new version. I just releases v0.2.1 which contains a fix in the module loader and also a updated example config.
Thanks for reporting this :)