Telegraf: exception invalid memory address or nil pointer dereference

Created on 20 May 2016  路  10Comments  路  Source: influxdata/telegraf

monitor mysql 5.0...may cause this problem

github.com/influxdata/telegraf/agent.panicRecover(0xc820164930)
    /home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/agent/agent.go:96 +0xa9
panic(0x10241a0, 0xc82000e0e0)
    /usr/local/go/src/runtime/panic.go:426 +0x4e9
database/sql.(*Rows).Next(0x0, 0x1399fc0)
    /usr/local/go/src/database/sql/sql.go:1751 +0x22
github.com/influxdata/telegraf/plugins/inputs/mysql.(*Mysql).gatherServer(0xc820166780, 0xc8200e85c0, 0x3b, 0x7f6fae1aa020, 0xc8200e8580, 0x0, 0x0)
    /home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/plugins/inputs/mysql/mysql.go:196 +0xdad
github.com/influxdata/telegraf/plugins/inputs/mysql.(*Mysql).Gather(0xc820166780, 0x7f6fae1aa020, 0xc8200e8580, 0x0, 0x0)
    /home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/plugins/inputs/mysql/mysql.go:52 +0x12f
github.com/influxdata/telegraf/agent.(*Agent).gatherParallel.func1(0xc8206d4450, 0xc8201a00c0, 0xc820026058, 0x0, 0xc820164930)
    /home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/agent/agent.go:139 +0x42e
created by github.com/influxdata/telegraf/agent.(*Agent).gatherParallel
    /home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/agent/agent.go:143 +0x442

goroutine 1 [runnable]:
syscall.Syscall(0x1, 0x2, 0xc820707200, 0x56, 0x56, 0x56, 0x0)
    /usr/local/go/src/syscall/asm_linux_amd64.s:18 +0x5
syscall.write(0x2, 0xc820707200, 0x56, 0x900, 0x0, 0x0, 0x0)
    /usr/local/go/src/syscall/zsyscall_linux_amd64.go:1064 +0x5f
syscall.Write(0x2, 0xc820707200, 0x56, 0x900, 0x5, 0x0, 0x0)
    /usr/local/go/src/syscall/syscall_unix.go:180 +0x4d
os.(*File).write(0xc820026018, 0xc820707200, 0x56, 0x900, 0x0, 0x0, 0x0)
    /usr/local/go/src/os/file_unix.go:249 +0xaa
os.(*File).Write(0xc820026018, 0xc820707200, 0x56, 0x900, 0x1bbaee0, 0x0, 0x0)
    /usr/local/go/src/os/file.go:136 +0x8a
log.(*Logger).Output(0xc8200640a0, 0x2, 0xc820186050, 0x42, 0x0, 0x0)
    /usr/local/go/src/log/log.go:166 +0x37a
log.Printf(0x136d680, 0x36, 0xc8204157f0, 0x3, 0x3)
    /usr/local/go/src/log/log.go:289 +0x80
github.com/influxdata/tel
bug

All 10 comments

please provide telegraf version and configuration

[global_tags]

[agent]
  interval = "60s"
  round_interval = true

  metric_buffer_limit = 1000
  flush_buffer_when_full = true

  collection_jitter = "0s"

  flush_interval = "10s"
  flush_jitter = "0s"

  debug = false
  quiet = false
  hostname = ""
  omit_hostname = false


[[outputs.influxdb]]
  urls = ["http://localhost:8086"] # required
  database = "collect" # required
  retention_policy = "collect_policy"
  precision = "s"

  timeout = "5s"
  username = "ar********"
  password = "ar*********"


###############################################################################
#                            INPUT PLUGINS                                    #
###############################################################################

[[inputs.cpu]]
  percpu = true
  totalcpu = true
  fielddrop = ["time_*"]

[[inputs.disk]]

  ignore_fs = ["tmpfs", "devtmpfs"]

[[inputs.diskio]]

[[inputs.kernel]]

[[inputs.mem]]

[[inputs.processes]]

[[inputs.swap]]

[[inputs.system]]

#mysql version is 5.0
[[inputs.mysql]]
servers = ["msy****:mysq****@tcp(117.***.***.***:****1)/"]

[[inputs.mysql]]
servers = ["msy****:mysq****@tcp(117.***.***.***:****2)/"]

[[inputs.mysql]]
servers = ["msy****:mysq****@tcp(117.***.***.***:****4)/"]

telegraf version 0.13.0

Looks like there is a bug with multiple mysql inputs, as a workaround try changing

[[inputs.mysql]]
servers = ["msy****:mysq****@tcp(117.***.***.***:****1)/"]

[[inputs.mysql]]
servers = ["msy****:mysq****@tcp(117.***.***.***:****2)/"]

[[inputs.mysql]]
servers = ["msy****:mysq****@tcp(117.***.***.***:****4)/"]

to

[[inputs.mysql]]
servers = [
                 "msy****:mysq****@tcp(117.***.***.***:****1)/",
                 "msy****:mysq****@tcp(117.***.***.***:****2)/",
                 "msy****:mysq****@tcp(117.***.***.***:****4)/",
]
servers = [
        "root:1qaz!QAZ@tcp(127.0.0.1:3306)/",
        "ms****:my****@tcp(1***.***.***.***:**70)/",
        "ms****:my****@tcp(1***.***.***.***:**72)/",
        "ms****:my****@tcp(1***.***.***.***:**75)/",
]

exception
2016/05/23 16:50:00 FATAL: Input [mysql] panicked: runtime error: invalid memory address or nil pointer dereference, Stack:
goroutine 46 [running]:
github.com/influxdata/telegraf/agent.panicRecover(0xc82006f5c0)
/home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/agent/agent.go:96 +0xa9
panic(0x10241a0, 0xc82000e0e0)
/usr/local/go/src/runtime/panic.go:426 +0x4e9
database/sql.(_Rows).Next(0x0, 0x1399fc0)
/usr/local/go/src/database/sql/sql.go:1751 +0x22
github.com/influxdata/telegraf/plugins/inputs/mysql.(_Mysql).gatherServer(0xc8200f5180, 0xc8201e4f80, 0x3b, 0x7f8337fdd868, 0xc8201a00c0, 0x0, 0x0)
/home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/plugins/inputs/mysql/mysql.go:196 +0xdad
github.com/influxdata/telegraf/plugins/inputs/mysql.(_Mysql).Gather(0xc8200f5180, 0x7f8337fdd868, 0xc8201a00c0, 0x0, 0x0)
/home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/plugins/inputs/mysql/mysql.go:52 +0x12f
github.com/influxdata/telegraf/agent.(_Agent).gatherParallel.func1(0xc8204b06f0, 0xc8202c82a0, 0xc82038c010, 0x0, 0xc82006f5c0)
/home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/agent/agent.go:139 +0x42e
created by github.com/influxdata/telegraf/agent.(*Agent).gatherParallel
/home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/agent/agent.go:143 +0x442

goroutine 1 [runnable]:
sync.runtime_Semacquire(0xc8204b06fc)
/usr/local/go/src/runtime/sema.go:47 +0x26
sync.(_WaitGroup).Wait(0xc8204b06f0)
/usr/local/go/src/sync/waitgroup.go:127 +0xb4
github.com/influxdata/telegraf/agent.(_Agent).gatherParallel(0xc82038c010, 0xc8202c82a0, 0x0, 0x0)
/home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/agent/agent.go:150 +0x145
github.com/influxdata/telegraf/agent.(*Agent).Run(0xc82038c010, 0xc8202c8060, 0x0, 0x0)
/home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/agent/agent.go:378 +0xa7e
main.main()
/home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/cmd/telegraf/telegraf.go:269 +0x261c

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1998 +0x1

goroutine 19 [syscall]:
os/signal.signal_recv(0x0)
/usr/local
2016/05/23 16:50:00 PLEASE REPORT THIS PANIC ON GITHUB with stack trace, configuration, and OS information: https://github.com/influxdata/telegraf/issues/new
2016/05/23 16:50:00 Gathered metrics, (1m0s interval), from 9 inputs in 156.72125ms

@tttMelody From your traceback it looks like you are actually using version 0.12, not 0.13. Since this plugin has changed significantly since 0.12, please try upgrading to 0.13 and try again with your initial config.

i think it may not about multiple mysql inputs cuz i used tried

[[inputs.mysql]]
servers = ["root:1qaz!QAZ@tcp(127.0.0.1:3306)/"]

[[inputs.mysql]]
servers = ["root:1qaz!QAZ@tcp(127.0.0.1:3307)/"]

[[inputs.mysql]]
servers = ["root:1qaz!QAZ@tcp(127.0.0.1:3308)/"]

it worked perfect
the only change is the version of databses
local db version is 5.1
117._._._:_*1 's version is 5.0.82
and it doesn't have this table: information_schema.GLOBAL_STATUS

OK, if you can give me a traceback with telegraf version 0.13 I can try to fix

after i update telegra and the problem seems have been solved,thanks a lot...

ok, thanks, please open a new issue if it's still a problem in 0.13

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SongYg picture SongYg  路  3Comments

mrcheeky123 picture mrcheeky123  路  3Comments

Bregor picture Bregor  路  3Comments

veerendra2 picture veerendra2  路  3Comments

corentingi picture corentingi  路  3Comments