pkg icon indicating copy to clipboard operation
pkg copied to clipboard

ConfigMap informer panics with DeletedFinalStateUnknown type assertion

Open infernus01 opened this issue 5 months ago • 5 comments

Description: The InformedWatcher in knative/pkg/configmap/informer/informed_watcher.go crashes when handling cache.DeletedFinalStateUnknown objects during ConfigMap deletion events.

Error: panic: interface conversion: interface {} is cache.DeletedFinalStateUnknown, not *v1.ConfigMap

Impact:

  • Causes webhook pods to crash and restart repeatedly

Root Cause: Unsafe type assertion in event handlers doesn't handle DeletedFinalStateUnknown objects

Proposed Fix: Add safe type assertion with DeletedFinalStateUnknown handling

infernus01 avatar Jul 28 '25 06:07 infernus01

/kind bug

infernus01 avatar Jul 28 '25 06:07 infernus01

Hi @infernus01 ,

Thanks for the bug report! Do you feel up for patching this issue, or are you hoping that someone else will do so?

From the description, it sounds like this may be a new state in Kubernetes. What Knative and Kubernetes versions are you using?

evankanderson avatar Jul 28 '25 16:07 evankanderson

Thanks for looking into this! Here are the version details: knative.dev/pkg version: v0.0.0-20250415155312-ed3e2158b883 Kubernetes client version: v1.32.2
k8s.io/client-go version: v0.32.7 Tekton Pipelines version: v1.2.0-38-g85152e436

And to answer if I'm gonna patch this issue, it is open to anyone who wants to take the initiative, since I've just started with using knative I might be missing some context. The problem that I suspect is The current knative.dev/pkg/configmap/informer/informed_watcher.go code performs unsafe type assertions:

func (i *InformedWatcher) deleteConfigMapEvent(obj interface{}) {
    configMap := obj.(*corev1.ConfigMap)  // UNSAFE - panics on DeletedFinalStateUnknown
    // ...
}

EDIT: I got to see DeletedFinalStateUnkown in the splunk logs when a pipeline is failed due to some exit code 2.

infernus01 avatar Jul 29 '25 05:07 infernus01

This issue is stale because it has been open for 90 days with no activity. It will automatically close after 30 more days of inactivity. Reopen the issue with /reopen. Mark the issue as fresh by adding the comment /remove-lifecycle stale.

github-actions[bot] avatar Oct 28 '25 01:10 github-actions[bot]

I can take this one and work on a fix. Will post a PR shortly.

anjalii-28 avatar Dec 13 '25 21:12 anjalii-28