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

Telegraf 0.13.1 panic in Disk Plugin #1297

Closed
lswith opened this issue May 31, 2016 · 5 comments · Fixed by #1302
Closed

Telegraf 0.13.1 panic in Disk Plugin #1297

lswith opened this issue May 31, 2016 · 5 comments · Fixed by #1302

Comments

@lswith
Copy link
Contributor

lswith commented May 31, 2016

Bug report

System info:

Telegraf 0.13.1
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04.5 LTS"

Relevant Config:

#
# INPUTS:
#
[[inputs.cpu]]
  percpu = true
  totalcpu = true
[[inputs.disk]]
[[inputs.diskio]]
[[inputs.kernel]]
[[inputs.mem]]
[[inputs.net]]
[[inputs.netstat]]
[[inputs.processes]]
[[inputs.puppetagent]]
[[inputs.swap]]
[[inputs.system]]

Error Message:

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x63fd09]

goroutine 98 [running]:
panic(0x107ebc0, 0xc820010080)
    /usr/local/go/src/runtime/panic.go:481 +0x3e6
github.com/influxdata/telegraf/plugins/inputs/system.(*systemPS).DiskUsage(0x1c78550, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
    /home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/plugins/inputs/system/ps.go:87 +0x829
github.com/influxdata/telegraf/plugins/inputs/system.(*DiskStats).Gather(0xc82005c1e0, 0x7f369a02ba88, 0xc8203f8000, 0x0, 0x0)
    /home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/plugins/inputs/system/disk.go:44 +0xd9
github.com/influxdata/telegraf/agent.gatherWithTimeout.func1(0xc8203f40c0, 0xc82005f110, 0xc8203f8000)
    /home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/agent/agent.go:174 +0x73
created by github.com/influxdata/telegraf/agent.gatherWithTimeout
    /home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/agent/agent.go:175 +0xe0
@alimousazy
Copy link
Contributor

alimousazy commented May 31, 2016

This patch will check for error and return it back instead of panic

diff --git a/plugins/inputs/system/ps.go b/plugins/inputs/system/ps.go
index 23bfe16..fd1b261 100644
--- a/plugins/inputs/system/ps.go
+++ b/plugins/inputs/system/ps.go
@@ -84,6 +84,9 @@ func (s *systemPS) DiskUsage(
                mountpoint := os.Getenv("HOST_MOUNT_PREFIX") + p.Mountpoint
                if _, err := os.Stat(mountpoint); err == nil {
                        du, err := disk.Usage(mountpoint)
+      if err != nil {
+        return nil, err
+      }
                        du.Path = p.Mountpoint
                        if err != nil {
                                return nil, err

@joshuaspence
Copy link

Hmm, but why is it failing in the first place?

@sparrc
Copy link
Contributor

sparrc commented May 31, 2016

with that change we'll get the error message and log it, rather than panicking :)

@joshuaspence
Copy link

Makes sense

@lachesis
Copy link

lachesis commented Aug 4, 2016

2016/08/04 03:40:00 ERROR in input [disk]: error getting disk usage info: too many levels of symbolic links

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.

5 participants