Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic on unchecked cast: interface conversion: interface {} is cache.DeletedFinalStateUnknown, not *unstructured.Unstructured #3238

Closed
Daimanta opened this issue Aug 12, 2024 · 0 comments · Fixed by #3282
Labels
bug Something isn't working

Comments

@Daimanta
Copy link
Contributor

Describe the bug
We have set up an argo eventsource in our kubernetes cluster. Regularly (but unpredictably), the eventsources crashes in a panic. The panic message is a consistent problem, namely that a cast of an interface is done without checking.

Here is an example of a panic stack trace:


goroutine 159 [running]:
github.com/argoproj/argo-events/eventsources/sources/resource.passFilters(0xffffffffffffffff?, 0xffffffffffffffff?, {0x1?, 0x0?, 0x5b89900?}, 0x1?)
	/home/runner/work/argo-events/argo-events/eventsources/sources/resource/start.go:290 +0xa53
github.com/argoproj/argo-events/eventsources/sources/resource.(*EventListener).StartListening.func2(0xc001a59b60)
	/home/runner/work/argo-events/argo-events/eventsources/sources/resource/start.go:131 +0x6b
github.com/argoproj/argo-events/eventsources/sources/resource.(*EventListener).StartListening.func3()
	/home/runner/work/argo-events/argo-events/eventsources/sources/resource/start.go:178 +0x122
created by github.com/argoproj/argo-events/eventsources/sources/resource.(*EventListener).StartListening in goroutine 93
	/home/runner/work/argo-events/argo-events/eventsources/sources/resource/start.go:173 +0x8e8

Checking the start.go:290 we can see an unchecked cast. An *unstructured.Unstructured is expected but in this case a cache.DeletedFinalStateUnknown is provided.

To Reproduce
Unfortunately, this is a thing that happens sometimes and we have a difficult time finding out when the specified panic happens.
In general, passing an *InformerEvent with an Obj that is not *unstructured.Unstructured, will fail the unchecked cast.

Expected behavior
If the InformerEvent Obj is not an *unstructured.Unstructured, it should be ignored in the passFilters function. In general, the eventsource should not crash for any reason, in this case when an unexpected type is encountered.

Environment (please complete the following information):

  • Kubernetes: v1.29.4
  • Argocli: v3.5.6
  • Argo Events: v1.9.2

Message from the maintainers:

If you wish to see this enhancement implemented please add a 👍 reaction to this issue! We often sort issues this way to know what to prioritize.

@Daimanta Daimanta added the bug Something isn't working label Aug 12, 2024
whynowy pushed a commit that referenced this issue Sep 19, 2024
MenD32 pushed a commit to MenD32/argo-events that referenced this issue Sep 23, 2024
Signed-off-by: MenD32 <amit@jounce.io>
whynowy pushed a commit that referenced this issue Nov 27, 2024
Signed-off-by: Derek Wang <whynowy@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant