fix(k8s): prevent goroutine leak and deadlock in pod watcher#3883
fix(k8s): prevent goroutine leak and deadlock in pod watcher#3883vishwas-droid wants to merge 3 commits into
Conversation
Signed-off-by: vishwas-droid <vishwasbajaj.global@gmail.com>
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: vishwas-droid The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Welcome @vishwas-droid! It looks like this is your first PR to knative/func 🎉 |
|
Hi @vishwas-droid. Thanks for your PR. I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
There was a problem hiding this comment.
Pull request overview
This PR updates the Kubernetes pod watcher logic in pkg/k8s to avoid goroutine leaks and hangs while waiting for a pod’s container termination state during runWithVolumeMounted.
Changes:
- Made the watcher goroutine context-aware so it can exit promptly on cancellation.
- Added an error channel to surface unexpected watch channel closure from the API server.
- Removed a redundant/dangerous double type assertion on
event.Objectto reduce panic risk.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
/ok-to-test |
|
@matejvasek Addressed the Copilot suggestion. PTAL. |
Changes
runWithVolumeMountedby making the pod watcher loop context-aware (<-localCtx.Done()).errChto handle abrupt or unexpected watch channel closures from the Kubernetes API server.event.Objectto eliminate any sudden runtime panic risks when unexpected object states are encountered./kind bug
Release Note