Skip to content

[Bug] Telegraf crashes when upgrading mongodb #3013

@wei-hai

Description

@wei-hai

Relevant telegraf.conf:

# Read metrics from one or many MongoDB servers
[[inputs.mongodb]]
  servers = ["mongodb://127.0.0.1:27017"]
  gather_perdb_stats = true

System info:

ubuntu 12.04
telegraf 1.3.3
mongodb 2.0.4

Steps to reproduce:

  1. start telegraf and mongodb
  2. run apt-get update to upgrade mongodb to latest version

Expected behavior:

telegraf should not crash and reconnect after mongodb upgrade

Actual behavior:

telegraf crashes

Additional info:

telegraf.log

2017-07-11T23:22:05Z E! Error in plugin [inputs.mongodb]: no reachable servers
2017-07-11T23:23:05Z E! Error in plugin [inputs.mongodb]: no reachable servers
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xc5b950]

goroutine 5765 [running]:
github.com/influxdata/telegraf/plugins/inputs/mongodb.NewStatLine(0xed0f7545c, 0x2d9af9c, 0x1bec540, 0xc4202a02d0, 0xc42087dae0, 0xc4208d3cf8, 0xc4201207a0, 0xed0f75510, 0x3208e81, 0x1bec540, ...)
	/home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/plugins/inputs/mongodb/mongostat.go:517 +0x340
github.com/influxdata/telegraf/plugins/inputs/mongodb.(*Server).gatherData(0xc420382940, 0x1b03540, 0xc4203828e0, 0x406001, 0x0, 0x0)
	/home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/plugins/inputs/mongodb/mongodb_server.go:107 +0xd0f
github.com/influxdata/telegraf/plugins/inputs/mongodb.(*MongoDB).gatherServer(0xc4202a6080, 0xc420382940, 0x1b03540, 0xc4203828e0, 0x1145a00, 0xc4207ac540)
	/home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/plugins/inputs/mongodb/mongodb.go:171 +0x89
github.com/influxdata/telegraf/plugins/inputs/mongodb.(*MongoDB).Gather.func1(0xc4207d9380, 0x1b03540, 0xc4203828e0, 0xc4202a6080, 0xc420382940)
	/home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/plugins/inputs/mongodb/mongodb.go:99 +0x73
created by github.com/influxdata/telegraf/plugins/inputs/mongodb.(*MongoDB).Gather
	/home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/plugins/inputs/mongodb/mongodb.go:100 +0x3ec

Metadata

Metadata

Assignees

Labels

bugunexpected problem or unintended behaviorpanicissue that results in panics from Telegraf

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions