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
[Structured Logging] when klog is passed nil, it causes components to panic while logging #100155
Comments
need update klog dependencies later. |
/milestone v1.21 Will set the milestone for the issue and let people review the PR during regular burndown. |
Scope check: potentially affected components are:
(grep for KObj: https://cs.k8s.io/?q=KObj&i=nope&files=&excludeFiles=&repos=) |
I looked in current implementation of handling Current fix should work on simple nil (https://play.golang.org/p/T5974AlFXc8):
but it will fail on structs implementing KMetadata interface, but not handling nil pointer (https://play.golang.org/p/2EL5nNhgY8E).
Reason is that interface with nil value is not nil. Resulting call to 'Log' function will panic on In stacktrace presented above it was Potential solutions:
Looking at all options I think that first one makes most sense as all other have bad impact on whole k/k repo |
Did benchmarking for using reflections, looks like performance overhead is not as significant as I previously anticipated, around 20%. I think we could consider using reflections. |
/cc @thockin @44past4 @DirectXMan12 |
/cc @dims |
There are hundreds of instances of |
With benchmark results being not as bad as first estimated I think we could use reflection in klog like proposed in kubernetes/klog#226 |
/reopen needs to get bumped in k/k to close |
@ehashman: Reopened this issue. 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. |
/triage accepted |
What happened:
When
klog.KObj
is passed anil
ref while logging, it panics:https://storage.googleapis.com/kubernetes-jenkins/pr-logs/pull/100050/pull-kubernetes-e2e-kind/1369786002343727104/artifacts/logs/kind-worker/kubelet.log
What you expected to happen:
nil
or an empty reference should be logged.How to reproduce it (as minimally and precisely as possible):
klog.KObj(nil)
Anything else we need to know?:
I have fixed this in kubernetes/klog#225 so we will need to bump klog.
ht @pacoxu for reporting in #100109
/priority critical-urgent
/sig instrumentation
The text was updated successfully, but these errors were encountered: