mirror of https://github.com/knative/pkg.git
shutdown must be called explicitly since pprof listen is part of the errgroup (#3203)
This commit is contained in:
parent
13b2dc9d2f
commit
68cdb02d48
|
@ -259,7 +259,6 @@ func MainWithConfig(ctx context.Context, component string, cfg *rest.Config, cto
|
|||
rest.SetDefaultWarningHandler(&logging.WarningHandler{Logger: logger})
|
||||
|
||||
pprof := newProfilingServer(logger.Named("pprof"))
|
||||
defer pprof.Shutdown(context.Background())
|
||||
|
||||
CheckK8sClientMinimumVersionOrDie(ctx, logger)
|
||||
cmw := SetupConfigMapWatchOrDie(ctx, logger)
|
||||
|
@ -340,6 +339,8 @@ func MainWithConfig(ctx context.Context, component string, cfg *rest.Config, cto
|
|||
// returns an error.
|
||||
<-egCtx.Done()
|
||||
|
||||
pprof.Shutdown(context.Background())
|
||||
|
||||
// Don't forward ErrServerClosed as that indicates we're already shutting down.
|
||||
if err := eg.Wait(); err != nil && !errors.Is(err, http.ErrServerClosed) {
|
||||
logger.Errorw("Error while running server", zap.Error(err))
|
||||
|
|
Loading…
Reference in New Issue