Given a service config that monitors a process that is already above a threshold inspeqtor will crash immediately after performing the check. Changing the checked value to a higher number prevents the panic. I haven't confirmed if this applies to other metrics or only total_rss
. The stack trace is included below.
Seems to be simply because there aren't any previous values.
check service puma
if memory:total_rss > 2g then alert, reload
W 2014-12-01T18:00:31.279422Z 15590 puma[memory:total_rss] triggered. Current value = 1217777664.0
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x20 pc=0x448ede]
goroutine 24 [running]:
runtime.panic(0x7bac20, 0xa298b3)
/usr/local/Cellar/go/1.3.3/libexec/src/pkg/runtime/panic.c:279 +0xf5
github.com/mperham/inspeqtor.(*Service).Verify(0xc20807e810, 0x0, 0x0, 0x0)
/Users/mike/src/github.com/mperham/inspeqtor/types.go:191 +0x30e
github.com/mperham/inspeqtor.(*Inspeqtor).verify(0xc208040160)
/Users/mike/src/github.com/mperham/inspeqtor/inspeqtor.go:310 +0x202
github.com/mperham/inspeqtor.(*Inspeqtor).scanSystem(0xc208040160)
/Users/mike/src/github.com/mperham/inspeqtor/inspeqtor.go:271 +0x35
github.com/mperham/inspeqtor.(*Inspeqtor).runLoop(0xc208040160)
/Users/mike/src/github.com/mperham/inspeqtor/inspeqtor.go:250 +0x115
created by github.com/mperham/inspeqtor.(*Inspeqtor).Start
/Users/mike/src/github.com/mperham/inspeqtor/inspeqtor.go:82 +0x1dc
goroutine 16 [chan receive]:
github.com/mperham/inspeqtor.HandleSignals()
/Users/mike/src/github.com/mperham/inspeqtor/inspeqtor.go:146 +0x170
main.main()
/Users/mike/src/github.com/mperham/inspeqtor-pro/main.go:57 +0x488
goroutine 19 [finalizer wait]:
runtime.park(0x416160, 0xa30e88, 0xa2f0c9)
/usr/local/Cellar/go/1.3.3/libexec/src/pkg/runtime/proc.c:1369 +0x89
runtime.parkunlock(0xa30e88, 0xa2f0c9)
/usr/local/Cellar/go/1.3.3/libexec/src/pkg/runtime/proc.c:1385 +0x3b
runfinq()
/usr/local/Cellar/go/1.3.3/libexec/src/pkg/runtime/mgc0.c:2644 +0xcf
runtime.goexit()
/usr/local/Cellar/go/1.3.3/libexec/src/pkg/runtime/proc.c:1445
goroutine 20 [syscall]:
os/signal.loop()
/usr/local/Cellar/go/1.3.3/libexec/src/pkg/os/signal/signal_unix.go:21 +0x1e
created by os/signal.init·1
/usr/local/Cellar/go/1.3.3/libexec/src/pkg/os/signal/signal_unix.go:27 +0x32
goroutine 21 [chan receive]:
main.ping(0xc20803e720, 0x13, 0xc208004420)
/Users/mike/src/github.com/mperham/inspeqtor-pro/licensing.go:123 +0x1d3
created by main.phoneHome
/Users/mike/src/github.com/mperham/inspeqtor-pro/licensing.go:105 +0x157
goroutine 22 [select]:
github.com/mperham/inspeqtor-pro/jobs.func·001()
/Users/mike/src/github.com/mperham/inspeqtor-pro/jobs/types.go:68 +0x13a
created by github.com/mperham/inspeqtor-pro/jobs.Watch
/Users/mike/src/github.com/mperham/inspeqtor-pro/jobs/types.go:80 +0xb0
goroutine 23 [IO wait]:
net.runtime_pollWait(0x7fe4c8b5b008, 0x72, 0x0)
/usr/local/Cellar/go/1.3.3/libexec/src/pkg/runtime/netpoll.goc:146 +0x66
net.(*pollDesc).Wait(0xc20802a680, 0x72, 0x0, 0x0)
/usr/local/Cellar/go/1.3.3/libexec/src/pkg/net/fd_poll_runtime.go:84 +0x46
net.(*pollDesc).WaitRead(0xc20802a680, 0x0, 0x0)
/usr/local/Cellar/go/1.3.3/libexec/src/pkg/net/fd_poll_runtime.go:89 +0x42
net.(*netFD).accept(0xc20802a620, 0x8c59e0, 0x0, 0x7fe4c8b59418, 0xb)
/usr/local/Cellar/go/1.3.3/libexec/src/pkg/net/fd_unix.go:419 +0x343
net.(*UnixListener).AcceptUnix(0xc2080747c0, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.3.3/libexec/src/pkg/net/unixsock_posix.go:293 +0x73
net.(*UnixListener).Accept(0xc2080747c0, 0x0, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.3.3/libexec/src/pkg/net/unixsock_posix.go:304 +0x4b
github.com/mperham/inspeqtor.(*Inspeqtor).acceptCommand(0xc208040160, 0x0)
/Users/mike/src/github.com/mperham/inspeqtor/commands.go:51 +0x63
github.com/mperham/inspeqtor.(*Inspeqtor).safelyAccept(0xc208040160, 0x0)
/Users/mike/src/github.com/mperham/inspeqtor/inspeqtor.go:95 +0x40
github.com/mperham/inspeqtor.func·002()
/Users/mike/src/github.com/mperham/inspeqtor/inspeqtor.go:74 +0x33
created by github.com/mperham/inspeqtor.(*Inspeqtor).Start
/Users/mike/src/github.com/mperham/inspeqtor/inspeqtor.go:79 +0x199