bosun-monitor / bosun

Time Series Alerting Framework
http://bosun.org
MIT License
3.4k stars 495 forks source link

Bug: tsdbrelay panicking on startup #2475

Closed muffix closed 4 years ago

muffix commented 4 years ago

Expected behaviour

Please describe the behaviour you are expecting

tsdbrelay starts up successfully

Current behaviour

What is the current behaviour?

tsdbrelay panics on startup (see logs below)

Steps to reproduce

Please provide detailed steps for reproducing the issue.

  1. Compile form latest master
  2. Run with e.g. these options: tsdbrelay -b localhost:8070 -t localhost:4242 -l 0.0.0.0:5252 -redis localhost:9565

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

Standalone binary with dependencies (Bosun, OpenTSDB, Ledis) running in Docker containers on the same host.

2439 introduced a configurable hostname option which uses a HostManager that requires initialisation. The tsdbrelay command doesn't do that.

I'm going to raise a PR for this.

Logs

Please include any relevant log snippets or files here.

Startup log:

2020/05/11 09:42:15 info: main.go:97: tsdbrelay version 0.8.0-dev last modified 2020-05-11T09:37:48Z
2020/05/11 09:42:15 info: main.go:98: listen on 0.0.0.0:5252
2020/05/11 09:42:15 info: main.go:99: relay to bosun at localhost:8070
2020/05/11 09:42:15 info: main.go:100: relay to tsdb at localhost:4242
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x6cac04]

goroutine 1 [running]:
bosun.org/collect.check(0x78dc08, 0xf, 0xc0000e9ca8, 0x4385fe, 0xc0000e9c58)
        /bosun/collect/collect.go:403 +0x264
bosun.org/collect.Set(0x78dc08, 0xf, 0xc0000871a0, 0x7a4c30, 0x1, 0xc00009c6e0)
        /bosun/collect/collect.go:316 +0x43
bosun.org/collect.InitChan(0xc0000e9ed0, 0x78c0eb, 0x9, 0xc00007a120, 0xc0000b2370, 0xc0000e2280)
        /bosun/collect/collect.go:123 +0x21d
bosun.org/collect.Init(...)
        /bosun/collect/collect.go:192
main.main()
        /bosun/cmd/tsdbrelay/main.go:167 +0xa64
2020-05-11 09:42:15,594 INFO exited: tsdbrelay (exit status 2; not expected)