Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

segmentation fault when starting after upgrading to v0.2.0 #35

Closed
andir opened this issue Dec 1, 2018 · 2 comments
Closed

segmentation fault when starting after upgrading to v0.2.0 #35

andir opened this issue Dec 1, 2018 · 2 comments
Labels
bug Something isn't working

Comments

@andir
Copy link

andir commented Dec 1, 2018

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:

CptHook/main.go

Lines 87 to 98 in a04922c

for moduleName := range configurtaion.Modules {
module, err := createModuleObject(moduleName)
if err != nil {
log.Error(err)
}
log.Infof("Loaded module %q", moduleName)
configPath := fmt.Sprintf("modules.%s", moduleName)
module.Init(viper.Sub(configPath), &inputChannel)
channelList = append(channelList, module.GetChannelList()...)
http.HandleFunc(module.GetEndpoint(), module.GetHandler())
}

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
@andir
Copy link
Author

andir commented Dec 1, 2018

The example configuration should also be changed. At least the status module must be removed.

modules:
status:
enabled: true

@fleaz fleaz added the bug Something isn't working label Dec 2, 2018
@fleaz
Copy link
Owner

fleaz commented Dec 2, 2018

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 :)

@fleaz fleaz closed this as completed Dec 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants