Skip to content

Commit 3bdf1ad

Browse files
Address comment
1 parent 69e892b commit 3bdf1ad

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pkg/manager/internal.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -550,8 +550,11 @@ func (cm *controllerManager) engageStopProcedure(stopComplete <-chan struct{}) e
550550
if cm.gracefulShutdownTimeout == 0 {
551551
return nil
552552
}
553-
cm.addMu.RLock()
554-
defer cm.addMu.RUnlock()
553+
554+
// NOTE: it is required to get the addMu write lock, so we are sure that we not starting any runnable
555+
// while we start waitForRunnableToEnd.
556+
cm.addMu.Lock()
557+
defer cm.addMu.Unlock()
555558

556559
// Note: stopProcedureEngaged is used by Add, AddMetricsExtraHandler, AddReadyzCheck, but it is safe to change here because
557560
// addMu.RLock() prevents the above functions to be executed concurrently with this operation.

0 commit comments

Comments
 (0)