Repository navigation
Closed
Labels
kind/bugCategorizes issue or PR as related to a bug.
Description
In what area(s)?
/area ksvc creation
/area autoscale
What version of Knative?
0.14, 0.15 and even see similar on current master HEAD
Expected Behavior
Expect the ksvc can be created successfully.
Actual Behavior
Failed to create ksvc with revisionmissing
Steps to Reproduce the Problem
Trying to generate 100 ksvc with cmd:
for i in {100..200}; do kn service create sbr-app-$i --image docker.io/cdlliuy/helloworld --min-scale 0 --no-wait & ; done
After that, several of ksvc didn't get ready at all.
[root@autoscaler1 logs ]$ kubectl get ksvc | grep -v True
NAME URL LATESTCREATED LATESTREADY READY REASON
sbr-app-175 http://sbr-app-175.yingtest.gen2-somaya-cd5bb76c946a0f930dd9607ba0ddd3a1-0001.eu-de.containers.appdomain.cloud sbr-app-175-swbxr-1 Unknown RevisionMissing
sbr-app-179 http://sbr-app-179.yingtest.gen2-somaya-cd5bb76c946a0f930dd9607ba0ddd3a1-0001.eu-de.containers.appdomain.cloud sbr-app-179-mfnzq-1 Unknown RevisionMissing
sbr-app-187 http://sbr-app-187.yingtest.gen2-somaya-cd5bb76c946a0f930dd9607ba0ddd3a1-0001.eu-de.containers.appdomain.cloud sbr-app-187-pzmqz-1 Unknown RevisionMissing
[root@autoscaler1 logs ]$ kubectl get revision | grep -v True
NAME CONFIG NAME K8S SERVICE NAME GENERATION READY REASON
sbr-app-175-swbxr-1 sbr-app-175 sbr-app-175-swbxr-1 1 Unknown Deploying
sbr-app-179-mfnzq-1 sbr-app-179 sbr-app-179-mfnzq-1 1 Unknown Deploying
sbr-app-187-pzmqz-1 sbr-app-187 sbr-app-187-pzmqz-1 1 Unknown Deploying
[root@autoscaler1 logs ]$ kubectl get Configuration | grep -v True
NAME LATESTCREATED LATESTREADY READY REASON
sbr-app-175 sbr-app-175-swbxr-1 Unknown
sbr-app-179 sbr-app-179-mfnzq-1 Unknown
sbr-app-187 sbr-app-187-pzmqz-1 Unknown
[root@autoscaler1 logs ]$ kubectl get kpa | grep 175
sbr-app-175-swbxr-1 0 0 False NoTraffic
[root@autoscaler1 logs ]$ kubectl get sks | grep 175
sbr-app-175-swbxr-1 Proxy 2 sbr-app-175-swbxr-1 sbr-app-175-swbxr-1-private Unknown NoHealthyBackends
[root@autoscaler1 logs ]$ kubectl get deployment | grep 175
sbr-app-175-swbxr-1-deployment 0/0 0 0 28m
[root@autoscaler1 logs ]$ kubectl get endpoints | grep 175
sbr-app-175-swbxr-1 172.17.33.212:8012 28m
sbr-app-175-swbxr-1-private <none> 28m
[root@autoscaler1 logs ]$ kubectl get svc | grep 175
sbr-app-175-swbxr-1 ClusterIP 172.21.187.65 <none> 80/TCP 28m
sbr-app-175-swbxr-1-private ClusterIP 172.21.29.82 <none> 80/TCP,9090/TCP,9091/TCP,8022/TCP 28m
sbr-app-199-pksjv-1-private ClusterIP 172.21.216.175 <none> 80/TCP,9090/TCP,9091/TCP,8022/TCP 29m
The revision CR got stuck with :
conditions:
- lastTransitionTime: "2020-07-01T03:16:54Z"
message: The target is not receiving traffic.
reason: NoTraffic
severity: Info
status: "False"
type: Active
- lastTransitionTime: "2020-07-01T03:15:10Z"
reason: Deploying
status: Unknown
type: ContainerHealthy
- lastTransitionTime: "2020-07-01T03:15:10Z"
reason: Deploying
status: Unknown
type: Ready
- lastTransitionTime: "2020-07-01T03:15:10Z"
reason: Deploying
status: Unknown
type: ResourcesAvailable
containerStatuses:
Also, although I reproduced this problem with multiple ksvc creation, we observed the similar failure when only creating one single ksvc in our daily continuous test.
It is a race condition issue, but just be easier to be reproduced under load.
Metadata
Metadata
Assignees
Labels
kind/bugCategorizes issue or PR as related to a bug.
Activity
cdlliuy commentedon Jul 2, 2020
Given there are only 3 of 100 knative service creation failed, I compared the succeed and failed logs file (by downloading controller and autoscaler log, grep + concat + sort by timestamp) below:
173_succeed.txt
174-succeed.txt
175-failed.txt
I did the following analysis:
active, the revision-controller need to markrevision ready;serving/pkg/apis/serving/v1alpha1/revision_lifecycle.go
Lines 235 to 244 in 61ccf67
But when the
revision-controllerdidn't have a chance to do reconcile when kpa isactive, later on, kpa status will be changed toinactive. As a result, therevision controllerwon't have any chance to make revision active anymore because of the following code:https://github.com/knative/serving/blob/master/pkg/reconciler/revision/reconcile_resources.go#L72-L74
serving/pkg/apis/serving/v1alpha1/revision_lifecycle.go
Lines 130 to 135 in 61ccf67
btw: the func name in above is confusing. IsActivationRequired() func returns True when revision.status is NOT true, when only when !IsActivationRequired(), the deployment status is propagated ..
Then, looking at the logs, when revision reconcile is good, I got:
In above successful log, reconcile controller had the chance to mark active by reconciling PA. but please notice the time difference here ! Almost 1 minute already.
================
In the failure case ..
In this case, PA was changed from active to inactive first before revision controller had a chance to reconsile PA..
As the result, the revision stayed in
deployingstate forever ...I can't explain why the revision-controller got KPA changes so late, but it did lose the chance to recover from the reconcile latency.
we may need more observation on the controller cpu /memory during the test..
Also, I think using a longer stable window for autoscale will be helpful to mitigate the issue.
Anyway, I also hope a fix to recover these type of failure from source code level .
cdlliuy commentedon Jul 2, 2020
@julz ^^
vagababov commentedon Jul 2, 2020
you actually got pretty good results. 200 simultaneous services is a lot. Our benchmark currently tops at 25.
/cc @mattmoor
markusthoemmes commentedon Jul 2, 2020
Great analysis @cdlliuy and I think you're right: Our PA status is dangerously running into races sometimes that causes the creating revision to be stuck forever. I have on my todo list to rework that a bit and I think we can piggyback on the new "HasBeenActive" state to do that. Gonna whip up a PoC.
markusthoemmes commentedon Jul 2, 2020
/assign
markusthoemmes commentedon Jul 2, 2020
Actually opted to write up a potential way to go about this first in #8540. I'd love to run this via a few API peeps to make sure we're not butchering things too much.
zhanggbj commentedon Jul 2, 2020
@vagababov @markusthoemmes btw, is the benchmark you mentioned above also available in serving repo or somewhere? I'm thinking we can also leverage it. thanks!
vagababov commentedon Jul 3, 2020