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 5 commits into
Conversation
|
[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. |
|
Please rebase on the main branch to fix the CI issues. |
Signed-off-by: vishwas-droid <vishwasbajaj.global@gmail.com>
8b99da8 to
ca8558b
Compare
|
Done, rebased on main. Can you please rerun the ci? |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3883 +/- ##
==========================================
+ Coverage 53.78% 53.88% +0.10%
==========================================
Files 200 200
Lines 23652 23674 +22
==========================================
+ Hits 12721 12757 +36
+ Misses 9707 9683 -24
- Partials 1224 1234 +10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@vishwas-droid it appears that test related to your change has failed. Also have you addressed all the copilot's concerns? |
ca8558b to
4e9c6e2
Compare
|
@matejvasek Addressed the Copilot feedback, and the CI failure related to this PR has also been resolved. |
|
/retest |
|
You need to sign CLA. |
|
CLA signed, thanks. |
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