x-pack processor stop error is not logged
- Dominant language
- Go
- Stars
- 1.3k
- Forks
- 543
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 109
Description
Let's say we return an error on process.Stop in aggregator:
```go
--- a/x-pack/apm-server/aggregation/baseaggregator/aggregator.go
+++ b/x-pack/apm-server/aggregation/baseaggregator/aggregator.go
@@ -151,5 +151,6 @@ func (a *Aggregator) Stop(ctx context.Context) error {
case <-ctx.Done():
return ctx.Err()
}
+ return errors.New("boom")
return nil
}
```
Then send a signal to apm-server to shutdown. The "boom" error will be returned but is never logged. It is also discarded in Runner.Run, as ctx is canceled, g.Wait() will only return the first non-nil error, which most likely a context.Canceled (or a wrapped context.Canceled) from other g.Go (e.g. s.waitReady) rather than "boom". Therefore, "boom" is lost in the call chain as a result.
Contributor guide
Research direction
Start in x-pack/apm-server/aggregation/baseaggregator/aggregator.go, then trace how Runner.Run handles errors from the shutdown goroutines. Reproduce the issue by returning an error from process.Stop and sending a shutdown signal to apm-server; done means that error is not lost when another goroutine returns context.Canceled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend, observability-sre
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100