From 97354347fba0539c7d563d179f86296ddcbf30be Mon Sep 17 00:00:00 2001 From: Britt Gresham Date: Mon, 29 Aug 2022 19:59:07 +0000 Subject: [PATCH] core/runner: Fix server panic when runner is forgotten Before this commit when Waypoint was determining whether or not to remove a Runner from boltdb it was possible for runner to be nil at the time we attempted to determine what type of Runner the Runner was. This caused the server to panic as soon as the runner became unavailable. This commit fixes the panic by avoiding the runner from being set to nil by instead initializing an empty runner variable so that if a runner is not found the type can still be determined and the runner cleaned up. Fixes #3448 --- internal/server/boltdbstate/runner.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/server/boltdbstate/runner.go b/internal/server/boltdbstate/runner.go index 754ef621ed5..18442871f31 100644 --- a/internal/server/boltdbstate/runner.go +++ b/internal/server/boltdbstate/runner.go @@ -302,9 +302,10 @@ func (s *State) runnerSetAdoptionState( } func (s *State) runnerOffline(dbTxn *bolt.Tx, memTxn *memdb.Txn, id string) error { + var r *pb.Runner + r, err := s.runnerById(dbTxn, id) if status.Code(err) == codes.NotFound { - r = nil err = nil } if err != nil {