doublemarket / grafana-rrd-server

A HTTP server that helps Grafana read RRD files via Grafana Simple JSON Datasource plugin
MIT License
153 stars 38 forks source link

HTTP panics #38

Closed miken32 closed 6 years ago

miken32 commented 6 years ago

Unable to run the prebuilt binary (#37) I tried building my own. Pretty simple process:

yum install golang
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig go get github.com/doublemarket/grafana-rrd-server
./go/bin/grafana-rrd-server -r /var/lib/mrtg

Everything compiled without issue, but whenever it gets any HTTP request:

2018/03/01 12:59:00 http: panic serving [::1]:37128: runtime error: invalid memory address or nil pointer dereference
goroutine 18 [running]:
net/http.(*conn).serve.func1(0xc420100000)
    /usr/lib/golang/src/net/http/server.go:1697 +0xd0
panic(0x6aaa80, 0xa50db0)
    /usr/lib/golang/src/runtime/panic.go:491 +0x283
main.search.func1(0x700b10, 0x9, 0x0, 0x0, 0xa5c660, 0xc4200fa1e0, 0x10, 0x6b8900)
    /root/go/src/github.com/doublemarket/grafana-rrd-server/rrdserver.go:125 +0x46
path/filepath.Walk(0x700b10, 0x9, 0xc420108040, 0xc420121ca0, 0x42ae86)
    /usr/lib/golang/src/path/filepath/path.go:401 +0x76
main.search(0xa60220, 0xc42013c000, 0xc42010a400)
    /root/go/src/github.com/doublemarket/grafana-rrd-server/rrdserver.go:123 +0x98
net/http.HandlerFunc.ServeHTTP(0x7138e0, 0xa60220, 0xc42013c000, 0xc42010a400)
    /usr/lib/golang/src/net/http/server.go:1918 +0x44
net/http.(*ServeMux).ServeHTTP(0xa8a2c0, 0xa60220, 0xc42013c000, 0xc42010a400)
    /usr/lib/golang/src/net/http/server.go:2254 +0x130
net/http.serverHandler.ServeHTTP(0xc420072f70, 0xa60220, 0xc42013c000, 0xc42010a400)
    /usr/lib/golang/src/net/http/server.go:2619 +0xb4
net/http.(*conn).serve(0xc420100000, 0xa60760, 0xc420106040)
    /usr/lib/golang/src/net/http/server.go:1801 +0x71d
created by net/http.(*Server).Serve
    /usr/lib/golang/src/net/http/server.go:2720 +0x288

I'm completely unfamiliar with Go, so if there's any way I can provide more details please let me know! Running RHEL 6.9, go 1.9.2, and rrdtool 1.6.0

miken32 commented 6 years ago

Updated Grafana and now all of a sudden it works ok. Strange!