diff --git a/staging/src/k8s.io/dynamic-resource-allocation/client/generic.go b/staging/src/k8s.io/dynamic-resource-allocation/client/generic.go index 8ac672e7668..15ea24baeac 100644 --- a/staging/src/k8s.io/dynamic-resource-allocation/client/generic.go +++ b/staging/src/k8s.io/dynamic-resource-allocation/client/generic.go @@ -303,6 +303,8 @@ func (w *watchSomething[NP, N, OP]) ResultChan() <-chan watch.Event { } func (w *watchSomething[NP, N, OP]) run() { + defer utilruntime.HandleCrash() + defer close(w.resultChan) resultChan := w.upstream.ResultChan() for { e, ok := <-resultChan @@ -320,9 +322,6 @@ func (w *watchSomething[NP, N, OP]) run() { Type: e.Type, Object: NP(out), } - } else { - //nolint:logcheck // Shouldn't happen. - klog.Errorf("unexpected object with type %T received from watch", e.Object) } // This must not get blocked when the consumer stops reading, // hence the stopChan.