Bug 1377940

Summary: oc observe with --resync-period should prompt --names required rather than cause panic
Product: OpenShift Container Platform Reporter: Xingxing Xia <xxia>
Component: ocAssignee: Maciej Szulik <maszulik>
Status: CLOSED ERRATA QA Contact: Xingxing Xia <xxia>
Severity: low Docs Contact:
Priority: medium    
Version: 3.3.0CC: aos-bugs, ccoleman, jokerman, mmccomas
Target Milestone: ---Keywords: Rebase
Target Release: 3.9.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: Nil was causing command to fail. Consequence: Command was panic-ing. Fix: Add nil check. Result: oc observe is working correctly.
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-03-13 22:27:23 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 Xingxing Xia 2016-09-21 06:03:54 UTC
Description of problem:
oc observe with --resync-period should prompt --names required rather than cause panic

Version-Release number of selected component (if applicable):
v3.3.0.31

How reproducible:
Always

Steps to Reproduce:
1. Login to openshift, create project xxia-proj
2. Create sth, e.g. services
$ oc new-app -f https://raw.githubusercontent.com/openshift/origin/master/examples/sample-app/application-template-stibuild.json
3. Check --resync-period without --names
$ oc observe svc --resync-period=10s -- echo print

Actual results:
3. Caused panic:
# 2016-09-21T13:17:30+08:00 Sync started
# 2016-09-21T13:17:30+08:00 Sync 32365	echo print xxia-proj database
print xxia-proj database
# 2016-09-21T13:17:30+08:00 Sync 32346	echo print xxia-proj frontend
print xxia-proj frontend
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x28 pc=0x12f0539]

goroutine 30 [running]:
panic(0x2488dc0, 0xc82000e0f0)
	/usr/lib/golang/src/runtime/panic.go:481 +0x3e6
github.com/openshift/origin/vendor/k8s.io/kubernetes/pkg/client/cache.(*DeltaFIFO).Resync(0xc820250d10, 0x0, 0x0)
	/builddir/build/BUILD/atomic-openshift-git-0.aede597/_output/local/go/src/github.com/openshift/origin/vendor/k8s.io/kubernetes/pkg/client/cache/delta_fifo.go:501 +0xd9
github.com/openshift/origin/vendor/k8s.io/kubernetes/pkg/client/cache.(*Reflector).ListAndWatch.func1(0xc82007e348, 0xc820014cc0, 0xc8207e0c00, 0xc820079c80, 0xc82007e350)
	/builddir/build/BUILD/atomic-openshift-git-0.aede597/_output/local/go/src/github.com/openshift/origin/vendor/k8s.io/kubernetes/pkg/client/cache/reflector.go:285 +0x1c2
created by github.com/openshift/origin/vendor/k8s.io/kubernetes/pkg/client/cache.(*Reflector).ListAndWatch
	/builddir/build/BUILD/atomic-openshift-git-0.aede597/_output/local/go/src/github.com/openshift/origin/vendor/k8s.io/kubernetes/pkg/client/cache/reflector.go:292 +0xde3

Expected results:
3. Should prompt --names required, as oc observe -h says for usage of --resync-period.

Additional info:
If --names and --delete are specified, no panic.

Comment 1 Juan Vallejo 2017-10-03 20:05:35 UTC
PR: https://github.com/openshift/origin/pull/16474

Comment 2 Juan Vallejo 2017-10-13 16:54:26 UTC
Upstream PR [1] has merged. Tagging as UpcomingRelease

1. https://github.com/kubernetes/kubernetes/pull/53830

Comment 3 Juan Vallejo 2018-03-07 18:37:22 UTC
The fix from [1] is now in latest master.

1. https://github.com/kubernetes/kubernetes/pull/53830

Comment 4 Xingxing Xia 2018-03-08 09:04:20 UTC
Verified in 3.9.3, no panic now, command works well
$ oc observe svc --resync-period=10s -- echo print
# 2018-03-08T16:57:45+08:00 Sync started
# 2018-03-08T16:57:45+08:00 Sync 218204	echo print xxia-proj myapp
print xxia-proj myapp
# 2018-03-08T16:57:55+08:00 Sync 	echo print xxia-proj myapp
print xxia-proj myapp

Comment 7 errata-xmlrpc 2019-03-13 22:27:23 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-2019:0403