cmd/bosun/expr: fix crash on invalid graphite tags #1663

Merged
merged 1 commit into from Mar 11, 2016

Projects

None yet

2 participants

@avereha
Contributor
avereha commented Mar 11, 2016

Check that we are not generating invalid tags in parseGraphiteResponse
because that would result in a crash if we try to create an Incident
with these tags.

I was able to reproduce the crash using this alert:

alert example.graphite {
        template = generic
        $graphite = graphite("sumSeries(constantLine(1),constantLine(2))", "5m", "", "")
        warn = avg($graphite) > 1
}

panic: opentsdb: bad tag: constantLine(2))

goroutine 67 [running]:
panic(0xd70e60, 0xc8200e2610)
    /usr/local/Cellar/go/1.6/libexec/src/runtime/panic.go:464 +0x3e6
bosun.org/models.AlertKey.Group(0xc820846700, 0x40, 0xc820846700)
    /Users/avereha/src/go/src/bosun.org/models/alertKey.go:46 +0x286
bosun.org/cmd/bosun/sched.NewIncident(0xc820846700, 0x40, 0xc82034dbc0)
    /Users/avereha/src/go/src/bosun.org/cmd/bosun/sched/check.go:46 +0x11d
bosun.org/cmd/bosun/sched.(*Schedule).runHistory(0x18fcf60, 0xc82021c2c0, 0xc820846700, 0x40, 0xc820846740, 0xc820846e80, 0x0, 0x0, 0x0)
    /Users/avereha/src/go/src/bosun.org/cmd/bosun/sched/check.go:151 +0x3f1
bosun.org/cmd/bosun/sched.(*Schedule).RunHistory(0x18fcf60, 0xc82021c2c0)
    /Users/avereha/src/go/src/bosun.org/cmd/bosun/sched/check.go:91 +0x118
bosun.org/cmd/bosun/sched.(*Schedule).checkAlert(0x18fcf60, 0xc8200c0300)
    /Users/avereha/src/go/src/bosun.org/cmd/bosun/sched/alertRunner.go:54 +0xec
bosun.org/cmd/bosun/sched.(*Schedule).RunAlert(0x18fcf60, 0xc8200c0300)
    /Users/avereha/src/go/src/bosun.org/cmd/bosun/sched/alertRunner.go:41 +0x5f
created by bosun.org/cmd/bosun/sched.(*Schedule).Run
    /Users/avereha/src/go/src/bosun.org/cmd/bosun/sched/alertRunner.go:24 +0x1d4

This change fixes #1608(I tested this) and probably #710(same backtrace).

@avereha avereha cmd/bosun/expr: fix crash on invalid graphite tags
Check that we are not generating invalid tags in parseGraphiteResponse
because that would result in a crash if we try to create an Incident
with these tags.
235b725
@kylebrandt kylebrandt merged commit b602ab7 into bosun-monitor:master Mar 11, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@avereha avereha deleted the avereha:graphite_tag_crash branch Mar 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment