apm-server icon indicating copy to clipboard operation
apm-server copied to clipboard

x-pack processor stop error is not logged

Open carsonip opened this issue 1 year ago • 0 comments

Let's say we return an error on process.Stop in aggregator:

--- 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.

carsonip avatar Aug 07 '23 14:08 carsonip