-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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 in kube-apiserverver #117363
panic in kube-apiserverver #117363
Comments
/sig api-machinery |
I'm still trying to confirm that this is indeed caused by empty json passed to https://github.com/kubernetes/kube-openapi/blob/f5883ff37f0c685e2c0ad657c26c52baba49be6d/pkg/handler/handler.go#L91 but I can't force the CI to fail just now 😅 |
/cc @apelisse |
/assign |
Some preliminary investigation:
|
I really don't think that's the issue I think it's more likely something in the jsonCache → protoCache chain is passing a cache miss and zero-value |
@soltysh, can you add something like this to the CI run to try to figure out the path that leads to empty JSON: diff --git a/vendor/k8s.io/kube-openapi/pkg/handler/handler.go b/vendor/k8s.io/kube-openapi/pkg/handler/handler.go
index 84e90264653..f76e2815386 100644
--- a/vendor/k8s.io/kube-openapi/pkg/handler/handler.go
+++ b/vendor/k8s.io/kube-openapi/pkg/handler/handler.go
@@ -21,6 +21,7 @@ import (
"crypto/sha512"
"fmt"
"net/http"
+ "runtime/debug"
"strconv"
"time"
@@ -30,6 +31,7 @@ import (
openapi_v2 "github.com/google/gnostic/openapiv2"
"github.com/google/uuid"
"github.com/munnerz/goautoneg"
+
klog "k8s.io/klog/v2"
"k8s.io/kube-openapi/pkg/builder"
"k8s.io/kube-openapi/pkg/cached"
@@ -88,6 +90,12 @@ func NewOpenAPIServiceLazy(swagger cached.Data[*spec.Swagger]) *OpenAPIService {
if result.Err != nil {
return cached.NewResultErr[timedSpec](result.Err)
}
+ if len(result.Data.spec) == 0 {
+ err := fmt.Errorf("unexpectedly empty json")
+ fmt.Println(err)
+ debug.PrintStack()
+ return cached.NewResultErr[timedSpec](err)
+ }
proto, err := ToProtoBinary(result.Data.spec)
if err != nil {
return cached.NewResultErr[timedSpec](err) |
The panic we currently have is on the next line, I don't think that we'll add a lot of information since we'll have the same backtrace? |
Oh… right. Hrmm. Suggestions for figuring out how a zero length data is propagating here? |
Looking into it. It might be more useful to get the trace when we generate the json (and see if we actually generate a 0 length json), i.e. just before this line: https://github.com/kubernetes/kube-openapi/blob/master/pkg/handler/handler.go#L85 |
/triage accepted |
Thank you all for the investigation and help! |
reopening until fix is merged into kubernetes - #117705 (and 1.27 cherry-pick) |
What happened?
While bringing in k8s 1.27 into openshift I've noticed rare occurrences of the following panic in kube-apiserver:
The whole panic can be viewed here: https://gcsweb-ci.apps.ci.l2s4.p1.openshiftapps.com/gcs/origin-ci-test/logs/openshift-kubernetes-1524-ci-4.14-e2e-gcp-ovn-upgrade/1646803175610519552/artifacts/e2e-gcp-ovn-upgrade/gather-extra/artifacts/pods/openshift-kube-apiserver_kube-apiserver-ci-op-ndiw873z-dd74f-m7x98-master-2_kube-apiserver.log
What did you expect to happen?
No panic
How can we reproduce it (as minimally and precisely as possible)?
will fail in similar way as the panic above. The problematic bit seems to be here:
https://github.com/google/gnostic/blob/ade94e0d08cb9c60272a311608cd5dabd30d1813/openapiv2/document.go#L29
we're trying to read
Content
from a valid, empty document, which results in the panic.Kubernetes version
v1.27.0
Cloud provider
AWS, GCP
The text was updated successfully, but these errors were encountered: