You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Initial Revisions (at least) with crash-looping pods take a long time to terminate/clean up Pods #12691
good first issueDenotes an issue ready for a new contributor, according to the "help wanted" guidelines.help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/bugCategorizes issue or PR as related to a bug.triage/acceptedIssues which should be fixed (post-triage)
When creating a Revision with a pod which exits immediately, the Revision should (fairly quickly) report that Ready is Falseand terminate the Pods.
Actual Behavior
The pods stick around in CrashLoopBackOff for many restarts, and the Revision remains in "unknown" status for many minutes and eventually times out.
Steps to Reproduce the Problem
In one shell:
kn service create crasher --image nicolaka/netshoot # or even a "bash" image
Watch this stall out, check on the pods with kubectl get po, etc
In a second shell:
kn service update crasher --image projects.registry.vmware.com/tanzu_serverless/hello-yeti
The first kn service create will complete, and the service will be ready to serve!
BUT
The first Revision will still be in unknown status, and the Pod will still be present in CrashLoopBackOff, even many minutes after the failure.
After approximately 10 minutes, the Pod will finally be cleaned up, but the reported status.desiredScale for the KPA resource is still -1 at the end of that time.
Instructions 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/test-infra repository.
Poked around at this a bit, using Serving 1.2. Here's what I saw:
It looks like the initial revision gets set to Ready: False pretty quickly (almost simultaneous with the second revision getting ready).
The long time to remove the pod comes from the default ProgressDeadline, which is set to 10m by default. Once that is hit, QP gets a TERM signal and goes through it's usual shutdown process.
I think KPA want stayed at -1 until I curled the working service (I don't remember if I curled it or not right when the second revision came up).
(also tried Serving 1.0 and also saw Ready: False pretty quick)
Assuming I'm understanding what's going on here correctly (insert usual caveat about assuming 😄 ), would this be a fix to a special case where revision 1 is replaced by revision 2 before rev1 becomes ready?
changed the title [-]Initial Revisions (at least) with crash-looping pods never terminate/clean up Pods[/-][+]Initial Revisions (at least) with crash-looping pods take a long time to terminate/clean up Pods[/+]on Mar 11, 2022
hey @evankanderson I am a beginner in devops and learned linux, docker and kubernetes beginners course on Go and Python basics. Am I eligible with this much knowledge to be able to contribute to the tools. If not then could you suggest what all things I should learn more in order to get started.
I'd start out by figuring out how to get a dev build of Knative serving running in your environment. (Just built from main or a branch with no changes.)
After that, I'd try to reproduce the issue on your cluster without making any code changes. Once you can do that, I'd start making the changes suggested earlier in this thread (maybe start by initializing the serverlessservice scale to 1 rather than -1). Once you think you have the problem solved, I'd push the change to a branch on your fork and send a PR which references this issue.
If you can figure out how, a unit test would also be a good addition to your PR. If you can't figure out the best test scenario, we can certainly help with that - - mention it in your PR.
@muhammedanaskhan -- if you're still interested, I think I saw an interesting hint in #9531 (comment); I suspect that we should be connecting how long a Configuration takes to give up on a Revision with the ProgressDeadlineSeconds of the Deployment underlying the Revision.
$ k get kpa
NAME DESIREDSCALE ACTUALSCALE READY REASON
crasher-00001 -1 0 Unknown Queued
crasher-00002 1 1 True
Also, desired scale remains at -1 for the first KPA, even after the progress-deadline period:
$ k get kpa crasher-00001
NAME DESIREDSCALE ACTUALSCALE READY REASON
crasher-00001 -1 0 False NoTraffic
$ k get revision crasher-00001
NAME CONFIG NAME K8S SERVICE NAME GENERATION READY REASON ACTUAL REPLICAS DESIRED REPLICAS
crasher-00001 crasher 1 False ProgressDeadlineExceeded 0
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.
hey @andrew-delph so I retested the repro steps mentioned in the first comment - and I believe this was fixed in the latest release via the PR #14309
It's resolved since we propagate reachability appropriately and don't do weird things like reading the Active conditions. Thus older revisions that aren't pointed to by a route will scale down correctly now.
I'm going to close this one out - but if you're testing a similar scenario that you're trying to address can you create a new issue.
Also a related issue that someone is working on is here - #13677
That one is about requests coming in and timing out doesn't trigger scale down as quickly as they could
good first issueDenotes an issue ready for a new contributor, according to the "help wanted" guidelines.help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/bugCategorizes issue or PR as related to a bug.triage/acceptedIssues which should be fixed (post-triage)
Activity
evankanderson commentedon Mar 3, 2022
(It seems to take about 10 minutes to fill in the
spec.Reachabilityfield, which I suspect is what is causing the scale back down to zero)evankanderson commentedon Mar 3, 2022
/good-first-issue
knative-prow-robot commentedon Mar 3, 2022
@evankanderson:
This request has been marked as suitable for new contributors.
Please ensure the request meets the requirements listed here.
If this request no longer meets these requirements, the label can be removed
by commenting with the
/remove-good-first-issuecommand.Details
In response to this:
Instructions 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/test-infra repository.
psschwei commentedon Mar 3, 2022
Poked around at this a bit, using Serving 1.2. Here's what I saw:
It looks like the initial revision gets set to
Ready: Falsepretty quickly (almost simultaneous with the second revision getting ready).The long time to remove the pod comes from the default
ProgressDeadline, which is set to 10m by default. Once that is hit, QP gets a TERM signal and goes through it's usual shutdown process.I think KPA want stayed at
-1until I curled the working service (I don't remember if I curled it or not right when the second revision came up).(also tried Serving 1.0 and also saw Ready: False pretty quick)
Assuming I'm understanding what's going on here correctly (insert usual caveat about assuming 😄 ), would this be a fix to a special case where revision 1 is replaced by revision 2 before rev1 becomes ready?
evankanderson commentedon Mar 4, 2022
I haven't tested, but I think this also happens when you deploy a crashing version after a successful version is installed.
I suspect that there is a special case here (since initialization is a bit of a special case already).
[-]Initial Revisions (at least) with crash-looping pods never terminate/clean up Pods[/-][+]Initial Revisions (at least) with crash-looping pods take a long time to terminate/clean up Pods[/+]muhammedanaskhan commentedon Mar 20, 2022
hey @evankanderson I am a beginner in devops and learned linux, docker and kubernetes beginners course on Go and Python basics. Am I eligible with this much knowledge to be able to contribute to the tools. If not then could you suggest what all things I should learn more in order to get started.
evankanderson commentedon Mar 20, 2022
Hi @muhammedanaskhan,
I think this could be a good first issue for you.
I'd start out by figuring out how to get a dev build of Knative serving running in your environment. (Just built from
mainor a branch with no changes.)After that, I'd try to reproduce the issue on your cluster without making any code changes. Once you can do that, I'd start making the changes suggested earlier in this thread (maybe start by initializing the serverlessservice
scaleto1rather than-1). Once you think you have the problem solved, I'd push the change to a branch on your fork and send a PR which references this issue.evankanderson commentedon Mar 20, 2022
If you can figure out how, a unit test would also be a good addition to your PR. If you can't figure out the best test scenario, we can certainly help with that - - mention it in your PR.
evankanderson commentedon Apr 14, 2022
@muhammedanaskhan -- if you're still interested, I think I saw an interesting hint in #9531 (comment); I suspect that we should be connecting how long a Configuration takes to give up on a Revision with the ProgressDeadlineSeconds of the Deployment underlying the Revision.
psschwei commentedon Apr 14, 2022
A couple of extra details, in case they help.
Here's the KPA status changes over the course of the steps that Evan described:
Final state:
Also, desired scale remains at -1 for the first KPA, even after the progress-deadline period:
github-actions commentedon Jul 14, 2022
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 asfresh by adding the comment
/remove-lifecycle stale.35 remaining items
msiyaj commentedon Aug 21, 2023
/assign
lizzzcai commentedon Sep 20, 2023
Hi, we noticed the KNative service is stuck when there is a
Init:CrashLoopBackOffin init container, not sure if it fits the discussion here.knative version: 1.9.3
I would like to check if there is any solution for it as it consumes resources.
delphamk commentedon Nov 9, 2023
/assign
dprotaso commentedon Nov 21, 2023
/unassign @msiyaj
dprotaso commentedon Nov 22, 2023
hey @andrew-delph so I retested the repro steps mentioned in the first comment - and I believe this was fixed in the latest release via the PR #14309
It's resolved since we propagate reachability appropriately and don't do weird things like reading the
Activeconditions. Thus older revisions that aren't pointed to by a route will scale down correctly now.I'm going to close this one out - but if you're testing a similar scenario that you're trying to address can you create a new issue.
Also a related issue that someone is working on is here - #13677
That one is about requests coming in and timing out doesn't trigger scale down as quickly as they could
delphamk commentedon Nov 22, 2023
@dprotaso Thanks for the comments and feedback.