Skip to content

Commit 87e7d77

Browse files
committed
kube-aggregator: Fix goroutine leak
1 parent ec0eec6 commit 87e7d77

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

staging/src/k8s.io/kube-aggregator/pkg/controllers/status/available_controller.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,17 @@ func (c *AvailableConditionController) sync(key string) error {
321321
// we had trouble with slow dial and DNS responses causing us to wait too long.
322322
// we added this as insurance
323323
case <-time.After(6 * time.Second):
324+
defer func() {
325+
// errCh needs to have a reader since the above goroutine doing the work
326+
// needs to send to it. This is defered to ensure it runs
327+
// even if the post timeout work itself panics.
328+
go func() {
329+
res := <-errch
330+
if res != nil {
331+
fmt.Error("%v", res)
332+
}
333+
}()
334+
}()
324335
results <- fmt.Errorf("timed out waiting for %v", discoveryURL)
325336
return
326337
}

0 commit comments

Comments
 (0)