Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1612661

Summary: `oc debug ... -- $command` will meet panic error
Product: OpenShift Container Platform Reporter: zhou ying <yinzhou>
Component: ocAssignee: Juan Vallejo <jvallejo>
Status: CLOSED ERRATA QA Contact: Xingxing Xia <xxia>
Severity: high Docs Contact:
Priority: high    
Version: 3.11.0CC: aos-bugs, jokerman, mmccomas
Target Milestone: ---Keywords: Regression
Target Release: 3.11.0   
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: 2018-10-11 07:23:29 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 2018-08-06 06:01:43 UTC
Description of problem:
`oc debug ... -- $command` will meet panic error. `oc debug ...` without $command works

Version-Release number of selected component (if applicable):
oc v3.11.0-0.11.0
kubernetes v1.11.0+d4cacc0
openshift v3.11.0-0.11.0

How reproducible:
always

Steps to Reproduce:
1. Create a DC:
  `oc create -f https://raw.githubusercontent.com/openshift-qe/v3-testfiles/master/deployment/dc-with-two-containers.yaml`

2. Try to debug the running deployment with command:
  ` oc debug dc/dctest -- /bin/env`



Actual results:
2. Met panic error:
[root@dhcp-141-94 ~]# oc debug dc/dctest -- /bin/env
Defaulting container name to dctest-1.
Use 'oc describe pod/dctest-debug -n zhouyt' to see all of the containers in this pod.

Debugging with pod/dctest-debug, original command: /hello-openshift
Waiting for pod to start ...

Removing debug pod ...
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x2435826]

goroutine 1 [running]:
github.com/openshift/origin/pkg/oc/originpolymorphichelpers.NewLogsForObjectFn.func1(0x0, 0x0, 0x3102500, 0xc4214f6e00, 0x3102600, 0xc421a24f00, 0x0, 0xc421786ab0, 0x829966, 0xc421364ea0)
    /builddir/build/BUILD/atomic-openshift-git-0.c5fa1e4/_output/local/go/src/github.com/openshift/origin/pkg/oc/originpolymorphichelpers/logsforobject.go:33 +0x46
github.com/openshift/origin/vendor/k8s.io/kubernetes/pkg/kubectl/cmd.LogsOptions.getLogs(0x0, 0x0, 0x0, 0x0, 0x0, 0x3102600, 0xc421a24f00, 0x3102500, 0xc4214f6e00, 0x0, ...)
    /builddir/build/BUILD/atomic-openshift-git-0.c5fa1e4/_output/local/go/src/github.com/openshift/origin/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/logs.go:285 +0x93
github.com/openshift/origin/vendor/k8s.io/kubernetes/pkg/kubectl/cmd.LogsOptions.getPodLogs(0x0, 0x0, 0x0, 0x0, 0x0, 0x3102600, 0xc421a24f00, 0x3102500, 0xc4214f6e00, 0x0, ...)
    /builddir/build/BUILD/atomic-openshift-git-0.c5fa1e4/_output/local/go/src/github.com/openshift/origin/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/logs.go:266 +0x3a7
github.com/openshift/origin/vendor/k8s.io/kubernetes/pkg/kubectl/cmd.LogsOptions.RunLogs(0x0, 0x0, 0x0, 0x0, 0x0, 0x3102600, 0xc421a24f00, 0x3102500, 0xc4214f6e00, 0x0, ...)
    /builddir/build/BUILD/atomic-openshift-git-0.c5fa1e4/_output/local/go/src/github.com/openshift/origin/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/logs.go:256 +0x147
github.com/openshift/origin/pkg/oc/cli/debug.(*DebugOptions).RunDebug.func3(0xc400000008, 0x2e406a8)
    /builddir/build/BUILD/atomic-openshift-git-0.c5fa1e4/_output/local/go/src/github.com/openshift/origin/pkg/oc/cli/debug/debug.go:452 +0x501
github.com/openshift/origin/vendor/k8s.io/kubernetes/pkg/util/interrupt.(*Handler).Run(0xc421a807b0, 0xc421787848, 0x0, 0x0)
    /builddir/build/BUILD/atomic-openshift-git-0.c5fa1e4/_output/local/go/src/github.com/openshift/origin/vendor/k8s.io/kubernetes/pkg/util/interrupt/interrupt.go:103 +0xff
github.com/openshift/origin/pkg/oc/cli/debug.(*DebugOptions).RunDebug(0xc420987180, 0x0, 0x0)
    /builddir/build/BUILD/atomic-openshift-git-0.c5fa1e4/_output/local/go/src/github.com/openshift/origin/pkg/oc/cli/debug/debug.go:427 +0xd86
github.com/openshift/origin/pkg/oc/cli/debug.NewCmdDebug.func1(0xc420987400, 0xc4211127b0, 0x2, 0x3)
    /builddir/build/BUILD/atomic-openshift-git-0.c5fa1e4/_output/local/go/src/github.com/openshift/origin/pkg/oc/cli/debug/debug.go:171 +0x104
github.com/openshift/origin/vendor/github.com/spf13/cobra.(*Command).execute(0xc420987400, 0xc421112720, 0x3, 0x3, 0xc420987400, 0xc421112720)
    /builddir/build/BUILD/atomic-openshift-git-0.c5fa1e4/_output/local/go/src/github.com/openshift/origin/vendor/github.com/spf13/cobra/command.go:760 +0x2c1
github.com/openshift/origin/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc420d2cf00, 0xc4200cc000, 0xc4200cc010, 0xc420d2cf00)
    /builddir/build/BUILD/atomic-openshift-git-0.c5fa1e4/_output/local/go/src/github.com/openshift/origin/vendor/github.com/spf13/cobra/command.go:846 +0x30a
github.com/openshift/origin/vendor/github.com/spf13/cobra.(*Command).Execute(0xc420d2cf00, 0x2, 0xc420d2cf00)
    /builddir/build/BUILD/atomic-openshift-git-0.c5fa1e4/_output/local/go/src/github.com/openshift/origin/vendor/github.com/spf13/cobra/command.go:794 +0x2b
main.main()
    /builddir/build/BUILD/atomic-openshift-git-0.c5fa1e4/_output/local/go/src/github.com/openshift/origin/cmd/oc/oc.go:49 +0x365



Expected results:
2. Could debug running deployment.


Additional info:

Comment 1 Juan Vallejo 2018-08-06 17:53:22 UTC
Origin PR https://github.com/openshift/origin/pull/20550

Comment 2 Juan Vallejo 2018-08-14 14:20:00 UTC
Origin PR has merged. Moving to MODIFIED

Comment 4 zhou ying 2018-08-24 02:18:40 UTC
Confrimed with latest OCP , the issue has fixed:

oc v3.11.0-0.21.0
kubernetes v1.11.0+d4cacc0

openshift v3.11.0-0.21.0

Comment 6 errata-xmlrpc 2018-10-11 07:23:29 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-2018:2652