Bug 1893645

Summary: oc describe route SIGSEGV
Product: OpenShift Container Platform Reporter: Felipe M <fmarting>
Component: ocAssignee: Maciej Szulik <maszulik>
Status: CLOSED ERRATA QA Contact: zhou ying <yinzhou>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.6CC: aos-bugs, fgrosjea, jokerman, maszulik, mfojtik
Target Milestone: ---   
Target Release: 4.7.0   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: Missing nil check for route condition. Consequence: Describing route might crash oc application under certain conditions. Fix: Add necessary nil checks preventing the code from failing unexpectedly. Result: oc describe route always works
Story Points: ---
Clone Of:
: 1893693 (view as bug list) Environment:
Last Closed: 2021-02-24 15:29:19 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:
Bug Depends On:    
Bug Blocks: 1893693    

Description Felipe M 2020-11-02 09:45:31 UTC
Description of problem:
`oc describe route` crashes with SIGSEGV

Version-Release number of selected component (if applicable):
Client Version: 4.6.0
Server Version: 4.6.1
Kubernetes Version: v1.19.0+d59ce34

How reproducible:
I wasn't able to reproduce it on my 4.6.1 cluster with the 4.6.0 client using another service with a similar route, but I'm attaching the route from the customer and the traceback from the output. I'm also asking from a `--loglevel=9`


$ oc describe route -n dro-ako hello-plain
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1d7b4cf]

goroutine 1 [running]:
github.com/openshift/oc/pkg/helpers/describe.(*RouteDescriber).Describe.func1(0xc00072def0, 0x347a060, 0xc00135a3c0)
        /go/src/github.com/openshift/oc/pkg/helpers/describe/describer.go:917 +0x148f
github.com/openshift/oc/pkg/helpers/describe.tabbedString(0xc0017378a8, 0xc001737878, 0xc0008b17f0, 0x5, 0xc001737968)
        /go/src/github.com/openshift/oc/pkg/helpers/describe/helpers.go:37 +0xb0
github.com/openshift/oc/pkg/helpers/describe.(*RouteDescriber).Describe(0xc0000e3520, 0x7ffe091b7745, 0x7, 0x7ffe091b774d, 0xb, 0x1, 0x203000, 0x203000, 0x203000, 0x7)
        /go/src/github.com/openshift/oc/pkg/helpers/describe/describer.go:902 +0x496
k8s.io/kubectl/pkg/cmd/describe.(*DescribeOptions).Run(0xc000ff7ae0, 0x0, 0x31c65e8)
        /go/src/github.com/openshift/oc/vendor/k8s.io/kubectl/pkg/cmd/describe/describe.go:188 +0x4df
k8s.io/kubectl/pkg/cmd/describe.NewCmdDescribe.func1(0xc000ff2b00, 0xc0012e3300, 0x2, 0x4)
        /go/src/github.com/openshift/oc/vendor/k8s.io/kubectl/pkg/cmd/describe/describe.go:110 +0x9f
github.com/spf13/cobra.(*Command).execute(0xc000ff2b00, 0xc0012e32c0, 0x4, 0x4, 0xc000ff2b00, 0xc0012e32c0)
        /go/src/github.com/openshift/oc/vendor/github.com/spf13/cobra/command.go:846 +0x2c2
github.com/spf13/cobra.(*Command).ExecuteC(0xc00052d080, 0x2, 0xc00052d080, 0x2)
        /go/src/github.com/openshift/oc/vendor/github.com/spf13/cobra/command.go:950 +0x375
        /go/src/github.com/openshift/oc/cmd/oc/oc.go:110 +0x885

Additional info:
Attached route in YAML format.

Comment 4 zhou ying 2020-11-04 03:07:23 UTC
Checked the latest oc extracted from payload: 4.7.0-0.nightly-2020-11-03-224722, has contain the fixed pr: 

[root@dhcp-140-138 oc]# oc version -o yaml
  buildDate: "2020-11-02T20:31:44Z"
  compiler: gc
  gitCommit: 8150994e0392adb4aeade70d62974ca77b3740a4
  gitTreeState: clean
  gitVersion: openshift-clients-4.6.0-202006250705.p0-208-g8150994e0
  goVersion: go1.15.0
  major: ""
  minor: ""
  platform: linux/amd64
openshiftVersion: 4.6.0-0.nightly-2020-11-03-172112
releaseClientVersion: 4.7.0-0.nightly-2020-11-03-224722

[root@dhcp-140-138 oc]# git log 8150994e0392adb4aeade70d62974ca77b3740a4 |grep "#632"
    Merge pull request #632 from soltysh/bug1893645

Comment 9 errata-xmlrpc 2021-02-24 15:29:19 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 (Moderate: OpenShift Container Platform 4.7.0 security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

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