Bug 1415440

Summary: Can't top image info by command 'oadm top images'
Product: OpenShift Container Platform Reporter: zhou ying <yinzhou>
Component: Image RegistryAssignee: Michal Fojtik <mfojtik>
Status: CLOSED ERRATA QA Contact: ge liu <geliu>
Severity: high Docs Contact:
Priority: high    
Version: 3.4.1CC: aos-bugs, maszulik, xtian
Target Milestone: ---Keywords: Regression
Target Release: 3.4.z   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-02-09 21:56:38 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description zhou ying 2017-01-22 02:48:39 UTC
Description of problem:
By command 'oadm top images' to list the images info, met error: panic: runtime error: index out of range

Version-Release number of selected component (if applicable):
openshift version
openshift v3.4.1.0
kubernetes v1.4.0+776c994
etcd 3.1.0-rc.0

How reproducible:
always

Steps to Reproduce:
1. Give user 'system:image-pruner' privilege;
    `oadm policy add-cluster-role-to-user system:image-pruner zhouy`
2. Use command 'oadm top images' to list the image info.

Actual results:
2. Met error:
panic: runtime error: index out of range

goroutine 1 [running]:
panic(0x3cbbe80, 0xc420012140)
    /usr/lib/golang/src/runtime/panic.go:500 +0x1a1
github.com/openshift/origin/pkg/cmd/admin/top.getTags(0xc42096d8f0, 0xc4213909a0, 0xc4214d7020, 0x7953348, 0x69edca0)
    /builddir/build/BUILD/atomic-openshift-git-0.9e8d48b/_output/local/go/src/github.com/openshift/origin/pkg/cmd/admin/top/images.go:216 +0x29f
github.com/openshift/origin/pkg/cmd/admin/top.getImageStreamTags(0x69f5b60, 0xc420d58390, 0x69eb460, 0x7953348, 0x69edca0, 0xc420d58390, 0xc420d583c0, 0xc420d58390, 0xc420de5ee0, 0x7953348, ...)
    /builddir/build/BUILD/atomic-openshift-git-0.9e8d48b/_output/local/go/src/github.com/openshift/origin/pkg/cmd/admin/top/images.go:207 +0x1cf
github.com/openshift/origin/pkg/cmd/admin/top.TopImagesOptions.imagesTop(0xc420cf5980, 0xc420cf4d20, 0xc4203fec60, 0x69a5fa0, 0xc4206e2e20, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
    /builddir/build/BUILD/atomic-openshift-git-0.9e8d48b/_output/local/go/src/github.com/openshift/origin/pkg/cmd/admin/top/images.go:164 +0x497
github.com/openshift/origin/pkg/cmd/admin/top.TopImagesOptions.Run(0xc420cf5980, 0xc420cf4d20, 0xc4203fec60, 0x69a5fa0, 0xc4206e2e20, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
    /builddir/build/BUILD/atomic-openshift-git-0.9e8d48b/_output/local/go/src/github.com/openshift/origin/pkg/cmd/admin/top/images.go:115 +0x4c
github.com/openshift/origin/pkg/cmd/admin/top.NewCmdTopImages.func1(0xc4202b5b00, 0x7953348, 0x0, 0x0)
    /builddir/build/BUILD/atomic-openshift-git-0.9e8d48b/_output/local/go/src/github.com/openshift/origin/pkg/cmd/admin/top/images.go:55 +0x11a
github.com/openshift/origin/vendor/github.com/spf13/cobra.(*Command).execute(0xc4202b5b00, 0x7953348, 0x0, 0x0, 0xc4202b5b00, 0x7953348)
    /builddir/build/BUILD/atomic-openshift-git-0.9e8d48b/_output/local/go/src/github.com/openshift/origin/vendor/github.com/spf13/cobra/command.go:603 +0x439
github.com/openshift/origin/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc4203f46c0, 0xc42002a008, 0xc42002a018, 0xc4203f46c0)
    /builddir/build/BUILD/atomic-openshift-git-0.9e8d48b/_output/local/go/src/github.com/openshift/origin/vendor/github.com/spf13/cobra/command.go:689 +0x367
github.com/openshift/origin/vendor/github.com/spf13/cobra.(*Command).Execute(0xc4203f46c0, 0x4, 0xc4203f46c0)
    /builddir/build/BUILD/atomic-openshift-git-0.9e8d48b/_output/local/go/src/github.com/openshift/origin/vendor/github.com/spf13/cobra/command.go:648 +0x2b
main.main()
    /builddir/build/BUILD/atomic-openshift-git-0.9e8d48b/_output/local/go/src/github.com/openshift/origin/cmd/openshift/openshift.go:33 +0x165


Expected results:
2. Should list the images info succeed.


Additional info:

Comment 1 Michal Fojtik 2017-01-23 09:11:29 UTC
Fix: https://bugzilla.redhat.com/show_bug.cgi?id=1415196

Comment 2 Maciej Szulik 2017-01-23 09:51:45 UTC
Fix: https://github.com/openshift/origin/pull/12609

Comment 4 openshift-github-bot 2017-01-24 18:24:46 UTC
Commit pushed to master at https://github.com/openshift/origin

https://github.com/openshift/origin/commit/468c05792596a4eb0a201bbac04b54bfbb73029e
Bug 1415440: Check image history for zero size

Comment 5 Michal Fojtik 2017-01-24 19:53:14 UTC
Guess this is now waiting for new puddle that include this fix.

Comment 6 ge liu 2017-01-25 07:11:44 UTC
Verified in 3.4.1:

openshift v3.4.1.2
kubernetes v1.4.0+776c994
etcd 3.1.0-rc.0

# oadm policy add-cluster-role-to-user system:image-pruner  geliu

# oc login master-srvxxxx:8443

# # oadm top images
NAME									IMAGESTREAMTAG						PARENTS		USAGE							METADATA	STORAGE		
sha256:097910c09e1c2e1593f24aee236c64130a77a9d27e727e76d7c34802c88bb311	openshift/jboss-processserver63-openshift (1.3)
sha256:2527fe6337..., sha256:ee2a1ba5ad...									<none>				yes		0MiB		
sha256:751346ce6297d239782d221aba632b0bbf1b59326d985393e8a0e044e955ad29	openshift/php (latest,5.6)				<none>
<none>							yes		41.54MiB	
sha256:817a12c32a39bbe394944ba49de563e085f1d3c5266eb8e9723256bc4448680e	<none>							<none>		<none>
yes		0.66MiB		
sha256:2016dbbb91adb628d4bf1ad58a5c388f91bf643e319bf9301ada7d932e777b50	openshift/jboss-datagrid65-openshift (latest)
<none>														<none>				yes		...........................

Comment 8 errata-xmlrpc 2017-02-09 21:56:38 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:0268