Skip to content

Unhandled panic crash on rollout_history printer.PrintObj #1724

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

Closed
tahacodes opened this issue Feb 28, 2025 · 4 comments · Fixed by kubernetes/kubernetes#130503
Closed

Unhandled panic crash on rollout_history printer.PrintObj #1724

tahacodes opened this issue Feb 28, 2025 · 4 comments · Fixed by kubernetes/kubernetes#130503
Labels
kind/bug Categorizes issue or PR as related to a bug. sig/cli Categorizes an issue or PR as relevant to SIG CLI. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@tahacodes
Copy link
Contributor

What happened?

A panic crash happens when running the following command, the revision 200 does not exists

Command:

$ kubectl -n x rollout history deployment x-api --revision 200 -o yaml

Panic output:

panic: reflect: call of reflect.Value.Type on zero Value

goroutine 1 [running]:
reflect.Value.typeSlow({0x0?, 0x0?, 0x1400057d2b8?})
        reflect/value.go:2385 +0x134
reflect.Value.Type(...)
        reflect/value.go:2380
k8s.io/cli-runtime/pkg/printers.(*YAMLPrinter).PrintObj(0x1400019c278, {0x0, 0x0}, {0x104d21b98, 0x140001ac028})
        k8s.io/cli-runtime/pkg/printers/yaml.go:45 +0x104
k8s.io/cli-runtime/pkg/printers.(*OmitManagedFieldsPrinter).PrintObj(0x1400057d3e8?, {0x0?, 0x0?}, {0x104d21b98?, 0x140001ac028?})
        k8s.io/cli-runtime/pkg/printers/managedfields.go:47 +0x110
k8s.io/cli-runtime/pkg/printers.(*TypeSetterPrinter).PrintObj(0x1049e2ea0?, {0x0?, 0x0?}, {0x104d21b98?, 0x140001ac028?})
        k8s.io/cli-runtime/pkg/printers/typesetter.go:43 +0x19c
k8s.io/kubectl/pkg/cmd/rollout.(*RolloutHistoryOptions).Run.func1(0x140005f6a80, {0x0?, 0x0?})
        k8s.io/kubectl/pkg/cmd/rollout/rollout_history.go:180 +0x14c
k8s.io/cli-runtime/pkg/resource.(*DecoratedVisitor).Visit.DecoratedVisitor.Visit.func1(0x140005f6a80, {0x0?, 0x0?})
        k8s.io/cli-runtime/pkg/resource/visitor.go:368 +0xc4
k8s.io/cli-runtime/pkg/resource.ContinueOnErrorVisitor.Visit.func1(0x14000967778?, {0x0?, 0x0?})
        k8s.io/cli-runtime/pkg/resource/visitor.go:392 +0xf4
k8s.io/cli-runtime/pkg/resource.(*FlattenListVisitor).Visit.FlattenListVisitor.Visit.func1(0x14000967838?, {0x0?, 0x0?})
        k8s.io/cli-runtime/pkg/resource/visitor.go:429 +0xc4
k8s.io/cli-runtime/pkg/resource.(*Info).Visit(0x14000967868?, 0x103b29dd8?)
        k8s.io/cli-runtime/pkg/resource/visitor.go:96 +0x2c
k8s.io/cli-runtime/pkg/resource.VisitorList.Visit(...)
        k8s.io/cli-runtime/pkg/resource/visitor.go:198
k8s.io/cli-runtime/pkg/resource.FlattenListVisitor.Visit(...)
        k8s.io/cli-runtime/pkg/resource/visitor.go:424
k8s.io/cli-runtime/pkg/resource.ContinueOnErrorVisitor.Visit({{0x104d23640?, 0x14000272ae0?}}, 0x14000698b40)
        k8s.io/cli-runtime/pkg/resource/visitor.go:387 +0xa0
k8s.io/cli-runtime/pkg/resource.DecoratedVisitor.Visit(...)
        k8s.io/cli-runtime/pkg/resource/visitor.go:359
k8s.io/cli-runtime/pkg/resource.(*Result).Visit(0x1400074cc00, 0x1?)
        k8s.io/cli-runtime/pkg/resource/result.go:99 +0x48
k8s.io/kubectl/pkg/cmd/rollout.(*RolloutHistoryOptions).Run(0x14000526ee0)
        k8s.io/kubectl/pkg/cmd/rollout/rollout_history.go:164 +0x344
k8s.io/kubectl/pkg/cmd/rollout.NewCmdRolloutHistory.func1(0x140007af808?, {0x140008af280?, 0x2?, 0x8?})
        k8s.io/kubectl/pkg/cmd/rollout/rollout_history.go:93 +0x74
github.com/spf13/cobra.(*Command).execute(0x140007af808, {0x140008af200, 0x8, 0x8})
        github.com/spf13/[email protected]/command.go:989 +0x818
github.com/spf13/cobra.(*Command).ExecuteC(0x140002d3508)
        github.com/spf13/[email protected]/command.go:1117 +0x344
github.com/spf13/cobra.(*Command).Execute(...)
        github.com/spf13/[email protected]/command.go:1041
k8s.io/component-base/cli.run(0x140002d3508)
        k8s.io/component-base/cli/run.go:143 +0x20c
k8s.io/component-base/cli.RunNoErrOutput(...)
        k8s.io/component-base/cli/run.go:82
main.main()
        k8s.io/kubernetes/cmd/kubectl/kubectl.go:30 +0x20

What did you expect to happen?

I think the expected behaviour should be an error message indicating that the requested revision does not exist, similar to this error:

kubectl -n x rollout history deployment x-api --revision 200
# error: unable to find the specified revision

How can we reproduce it (as minimally and precisely as possible)?

Simply try to get a non-existing revision as yaml or json file. as previously mentioned:

Command:

$ kubectl -n x rollout history deployment x-api --revision 200 -o yaml

Anything else we need to know?

No response

Kubernetes version

$ kubectl version
Client Version: v1.32.2
Kustomize Version: v5.5.0
Server Version: v1.31.4

Cloud provider

NONE

OS version

MacOS 15.3.1 (24D70)

Install tools

No response

Container runtime (CRI) and version (if applicable)

No response

Related plugins (CNI, CSI, ...) and versions (if applicable)

No response

@tahacodes tahacodes added the kind/bug Categorizes issue or PR as related to a bug. label Feb 28, 2025
@k8s-ci-robot k8s-ci-robot added needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Feb 28, 2025
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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-sigs/prow repository.

@tahacodes
Copy link
Contributor Author

/sig cli

@k8s-ci-robot k8s-ci-robot added sig/cli Categorizes an issue or PR as relevant to SIG CLI. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Feb 28, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in SIG CLI Feb 28, 2025
@HirazawaUi
Copy link
Contributor

/transfer kubectl

@k8s-ci-robot k8s-ci-robot transferred this issue from kubernetes/kubernetes Mar 1, 2025
@brianpursley
Copy link
Member

Reproduced

/triage accepted

$ kubectl create deployment foo --image=nginx:1.26.3
deployment.apps/foo created
$ kubectl set image deployment foo nginx=nginx:1.27.4
deployment.apps/foo image updated
$ kubectl rollout status deployment foo
deployment "foo" successfully rolled out
$ kubectl rollout history deployment foo
deployment.apps/foo 
REVISION  CHANGE-CAUSE
1         <none>
2         <none>

$ kubectl rollout history deployment foo --revision 200 -o yaml
panic: reflect: call of reflect.Value.Type on zero Value

goroutine 1 [running]:
reflect.Value.typeSlow({0x0?, 0x0?, 0x30?})
	reflect/value.go:2687 +0x10e
reflect.Value.Type(...)
	reflect/value.go:2682
k8s.io/cli-runtime/pkg/printers.(*YAMLPrinter).PrintObj(0xc000e80398, {0x0, 0x0}, {0x27634e0, 0xc000136020})
	k8s.io/cli-runtime/pkg/printers/yaml.go:45 +0x139
k8s.io/cli-runtime/pkg/printers.(*OmitManagedFieldsPrinter).PrintObj(0x4707ab?, {0x0?, 0x0?}, {0x27634e0?, 0xc000136020?})
	k8s.io/cli-runtime/pkg/printers/managedfields.go:47 +0x116
k8s.io/cli-runtime/pkg/printers.(*TypeSetterPrinter).PrintObj(0x1f20a00?, {0x0?, 0x0?}, {0x27634e0?, 0xc000136020?})
	k8s.io/cli-runtime/pkg/printers/typesetter.go:43 +0x23c
k8s.io/kubectl/pkg/cmd/rollout.(*RolloutHistoryOptions).Run.func1(0xc00054a680, {0x0?, 0x0?})
	k8s.io/kubectl/pkg/cmd/rollout/rollout_history.go:180 +0x17e
k8s.io/cli-runtime/pkg/resource.(*DecoratedVisitor).Visit.DecoratedVisitor.Visit.func1(0xc00054a680, {0x0?, 0x0?})
	k8s.io/cli-runtime/pkg/resource/visitor.go:368 +0xa8
k8s.io/cli-runtime/pkg/resource.ContinueOnErrorVisitor.Visit.func1(0x10?, {0x0?, 0x0?})
	k8s.io/cli-runtime/pkg/resource/visitor.go:392 +0xe2
k8s.io/cli-runtime/pkg/resource.(*FlattenListVisitor).Visit.FlattenListVisitor.Visit.func1(0x3a59ae0?, {0x0?, 0x0?})
	k8s.io/cli-runtime/pkg/resource/visitor.go:429 +0xed
k8s.io/cli-runtime/pkg/resource.(*Info).Visit(0xc0001138d0?, 0x4107e5?)
	k8s.io/cli-runtime/pkg/resource/visitor.go:96 +0x1a
k8s.io/cli-runtime/pkg/resource.VisitorList.Visit(...)
	k8s.io/cli-runtime/pkg/resource/visitor.go:198
k8s.io/cli-runtime/pkg/resource.FlattenListVisitor.Visit(...)
	k8s.io/cli-runtime/pkg/resource/visitor.go:424
k8s.io/cli-runtime/pkg/resource.ContinueOnErrorVisitor.Visit({{0x2764ea0?, 0xc00033e660?}}, 0xc000e842c0)
	k8s.io/cli-runtime/pkg/resource/visitor.go:387 +0xc5
k8s.io/cli-runtime/pkg/resource.DecoratedVisitor.Visit(...)
	k8s.io/cli-runtime/pkg/resource/visitor.go:359
k8s.io/cli-runtime/pkg/resource.(*Result).Visit(0xc000bb2180, 0x1?)
	k8s.io/cli-runtime/pkg/resource/result.go:99 +0x39
k8s.io/kubectl/pkg/cmd/rollout.(*RolloutHistoryOptions).Run(0xc000213260)
	k8s.io/kubectl/pkg/cmd/rollout/rollout_history.go:164 +0x407
k8s.io/kubectl/pkg/cmd/rollout.NewCmdRolloutHistory.func1(0xc00074e008?, {0xc000184fc0?, 0x2?, 0x6?})
	k8s.io/kubectl/pkg/cmd/rollout/rollout_history.go:93 +0x6f
github.com/spf13/cobra.(*Command).execute(0xc00074e008, {0xc000184f60, 0x6, 0x6})
	github.com/spf13/[email protected]/command.go:989 +0xa91
github.com/spf13/cobra.(*Command).ExecuteC(0xc0003f6308)
	github.com/spf13/[email protected]/command.go:1117 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
	github.com/spf13/[email protected]/command.go:1041
k8s.io/component-base/cli.run(0xc0003f6308)
	k8s.io/component-base/cli/run.go:143 +0x245
k8s.io/component-base/cli.RunNoErrOutput(...)
	k8s.io/component-base/cli/run.go:82
main.main()
	k8s.io/kubernetes/cmd/kubectl/kubectl.go:30 +0x18

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Mar 3, 2025
@github-project-automation github-project-automation bot moved this from Needs Triage to Closed in SIG CLI Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. sig/cli Categorizes an issue or PR as relevant to SIG CLI. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Status: Closed
Development

Successfully merging a pull request may close this issue.

4 participants