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

TOML internal.Duration marshaller panics on integers #1926

Closed
denzuko opened this issue Oct 21, 2016 · 1 comment
Closed

TOML internal.Duration marshaller panics on integers #1926

denzuko opened this issue Oct 21, 2016 · 1 comment
Labels
bug unexpected problem or unintended behavior panic issue that results in panics from Telegraf
Milestone

Comments

@denzuko
Copy link
Contributor

denzuko commented Oct 21, 2016

Bug report

telegraf crashes with snmp input pointed to bigswitch

Relevant telegraf.conf:

'''
[[outputs.influxdb]]
urls = ["http://influxdbmaster:8086"] # required
database = "telegraf" # required

retention_policy = ""
write_consistency = "any"
timeout = "5s"

[[inputs.snmp]]
interval = "15s"
retries = 2
timeout = 5

version = 2
community="public"

agents = [ "bs1.example.tld", "bs2.example.tld" ]

[[inputs.snmp.table]]
name="bigswitch"

[[inputs.snmp.table.field]]
  name="memory"
  oid = ".1.3.6.1.4.1.25506.8.35.18.43.1.3"

'''

System info:

telegraf 1.0.0
influxdb 1.0.0
alpine linux

Steps to reproduce:

start telegraf

Expected behavior

Telegraf started and connected to influx

Actual behavior:

/ # telegraf
2016/10/21 20:39:22 Using config file: /etc/telegraf/telegraf.conf
panic: runtime error: slice bounds out of range

Additional info:

goroutine 1 [running]:
panic(0x12904a0, 0xc82000a050)
/usr/local/go/src/runtime/panic.go:481 +0x3e6
github.com/influxdata/telegraf/internal.(*Duration).UnmarshalTOML(0xc82014b7b8, 0xc8201a4a68, 0x1, 0x8, 0x0, 0x0)
/home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/internal/internal.go:39 +0x270
github.com/influxdata/toml.setUnmarshaler(0x1262080, 0xc82014b7b8, 0x199, 0xc8201a4a60, 0x1, 0x0, 0x0, 0xc8201a4a40)
/home/ubuntu/telegraf-build/src/github.com/influxdata/toml/decode.go:230 +0x2ec
github.com/influxdata/toml.setValue(0x1262080, 0xc82014b7b8, 0x199, 0x7f3ad67eeb18, 0xc8200136c0, 0x0, 0x0)

@phemmer
Copy link
Contributor

phemmer commented Oct 21, 2016

timeout = 5

should be

timeout = "5s"

...or whatever your unit is if not seconds.

Agree this is a bug though. Parser should throw a graceful error rather than panic. Dunno that this'll get fixed though if the plan is to switch parsers (#1598).

@sparrc sparrc added bug unexpected problem or unintended behavior panic issue that results in panics from Telegraf labels Oct 24, 2016
@sparrc sparrc changed the title Telegraf Crashes on startup when using snmp plugin TOML internal.Duration marshaller panics on integers Oct 24, 2016
@sparrc sparrc added this to the 1.1.0 milestone Oct 24, 2016
@sparrc sparrc closed this as completed in f729fa9 Oct 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unexpected problem or unintended behavior panic issue that results in panics from Telegraf
Projects
None yet
Development

No branches or pull requests

3 participants