feat: include check name in notice data for perform-check and recover-check (#444)
For notices of kind `change-updated`, the notice data will include the
`kind` field that is standard for these notices, but also when `kind` is
`perform-check` or `recover-check`, it will also include `check-name`,
set to the name of the check that is being performed or recovered.
docs: various improvements to "service dependencies" section (#442)
`on-check-failure` is a map of check name to value, so this field
doesn't have a default, you have to add keys and values to the map
explicitly. I believe this incorrect text was just a copy 'n' paste
error.
In addition, I've added a (hopefully-clarifying) paragraph and tweaked
things a bit.
fix(planstate): don't hold planLock while calling plan-changed listeners (#436)
Some listeners do quite a bit of stuff (check manager and log manager),
and they're defined in packages external to the planstate package, so
it's best to avoid holding our plan lock for the duration.
fix(daemon): turn off net/http panic recovery (#350)
By default, Go's `net/http` recovers panics in the `ServeHTTP` goroutine
and keeps serving. However, if a lock is held when the panic happens,
this will mean a complete deadlock and Pebble will go unresponsive. As
far as I know, this hasn't happened yet, but we use snippets without
`defer` like this fairly frequently if it's just a tiny amount of code
and defer is awkward:
```go
st.Lock()
foo := st.Foo()
st.Unlock()
```
If `st.Foo()` or whatever's between the lock and unlock panics,
`net/http` will recover the panic but the lock will still be held. And
in the case of the state lock that basically means all requests are
blocked -- bad!
There's no direct way of opting out of this `net/http` behaviour, so you
have to `recover()` from panics yourself, print the goroutine dump, and
exit.
I've tested this locally, and it prints the goroutine dump and exits
with code 1 on a panic as expected, instead of locking up. It also
handles any panic in the handler or middleware, eg in `logit`.