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

[0.11.0] httpjson: panic: runtime error: invalid memory address or nil pointer dereference #859

Closed
causelove-xyz opened this issue Mar 16, 2016 · 1 comment · Fixed by #861

Comments

@causelove-xyz
Copy link

After updating to version 0.11.0 telegraf started crashing at every collection cycle on one of 7 nodes.

Node used httpjson with following configuration:

   [[inputs.httpjson]]
        name='service_activeusers'
        method='GET'
        servers=['http://172.17.0.1:9030/active']

curl call works as expected:

[root@server telegraf]# curl http://172.17.0.1:9030/active
{"count":0}
[root@server telegraf]# telegraf -config /etc/telegraf/telegraf.conf -config-directory /etc/telegraf/telegraf.d
2016/03/16 15:23:45 Starting Telegraf (version 0.11.0)
2016/03/16 15:23:45 Loaded outputs: influxdb
2016/03/16 15:23:45 Loaded inputs: httpjson
2016/03/16 15:23:45 Tags enabled: host=server.example.org
2016/03/16 15:23:45 Agent Config: Interval:10s, Debug:false, Quiet:false, Hostname:"server.example.org", Flush Interval:10s
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x10 pc=0x6f80ad]

goroutine 31 [running]:
net/http.(*Client).doFollowingRedirects(0x0, 0xc820094380, 0x128b2a8, 0x0, 0x0, 0x0)
    /usr/local/go/src/net/http/client.go:313 +0x6d
net/http.(*Client).Do(0x0, 0xc820094380, 0x4ccc78, 0x0, 0x0)
    /usr/local/go/src/net/http/client.go:175 +0x9c
github.com/influxdata/telegraf/plugins/inputs/httpjson.RealHTTPClient.MakeRequest(0x0, 0xc820094380, 0x17b3b20, 0x0, 0x0)
    /home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/plugins/inputs/httpjson/httpjson.go:59 +0x37
github.com/influxdata/telegraf/plugins/inputs/httpjson.(*HttpJson).sendRequest(0xc82016ebb0, 0xc8200ad1e0, 0x1d, 0x0, 0x0, 0x0, 0x0, 0x0)
    /home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/plugins/inputs/httpjson/httpjson.go:263 +0x877
github.com/influxdata/telegraf/plugins/inputs/httpjson.(*HttpJson).gatherServer(0xc82016ebb0, 0x7ff3f61ada18, 0xc82016dd00, 0xc8200ad1e0, 0x1d, 0x0, 0x0)
    /home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/plugins/inputs/httpjson/httpjson.go:178 +0x5f
github.com/influxdata/telegraf/plugins/inputs/httpjson.(*HttpJson).Gather.func1(0xc8200ab030, 0xc82016ebb0, 0x7ff3f61ada18, 0xc82016dd00, 0xc820016de0, 0xc8200ad1e0, 0x1d)
    /home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/plugins/inputs/httpjson/httpjson.go:145 +0x7e
created by github.com/influxdata/telegraf/plugins/inputs/httpjson.(*HttpJson).Gather
    /home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/plugins/inputs/httpjson/httpjson.go:148 +0x3ab
@sparrc
Copy link
Contributor

sparrc commented Mar 16, 2016

ugh, this is why I hate methods without pointer receivers, I'll have a fix for this soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants