Bug 1737127
| Summary: | oc idle service cause runtime error: invalid memory address or nil pointer dereference | ||
|---|---|---|---|
| Product: | OpenShift Container Platform | Reporter: | Weibin Liang <weliang> |
| Component: | Networking | Assignee: | Dan Williams <dcbw> |
| Status: | CLOSED ERRATA | QA Contact: | Weibin Liang <weliang> |
| Severity: | urgent | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 4.2.0 | CC: | aos-bugs, cdc, dcbw, piqin |
| Target Milestone: | --- | ||
| Target Release: | 4.2.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: | 2019-10-16 06:34:33 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
Weibin Liang
2019-08-02 17:59:44 UTC
for _, pod := range podRefs {
controllerRef := metav1.GetControllerOf(pod)
ref := normalizedNSOwnerRef(pod.Namespace, controllerRef)
if controllerRef == nil {
return nil, fmt.Errorf("unable to find controller for pod %s/%s: no creator reference listed", pod.Namespace, pod.Name)
}
immediateControllerRefs[ref] = struct{}{}
}
GetControllerOf() can return nil, and normalizedNSOwnerRef() doesn't appear to handle that case since it dereferences the controllerRef pointer. Why it's nil, I have no idea.
diff --git a/staging/src/github.com/openshift/oc/pkg/cli/idle/idle.go b/staging/src/github.com/openshift/oc/pkg/cli/idle/idle.go
index 0dd48a390ce1f..04c79f89a5f6b 100644
--- a/staging/src/github.com/openshift/oc/pkg/cli/idle/idle.go
+++ b/staging/src/github.com/openshift/oc/pkg/cli/idle/idle.go
@@ -405,10 +405,10 @@ func findScalableResourcesForEndpoints(endpoints *corev1.Endpoints, getPod func(
immediateControllerRefs := make(map[namespacedOwnerReference]struct{})
for _, pod := range podRefs {
controllerRef := metav1.GetControllerOf(pod)
- ref := normalizedNSOwnerRef(pod.Namespace, controllerRef)
if controllerRef == nil {
return nil, fmt.Errorf("unable to find controller for pod %s/%s: no creator reference listed", pod.Namespace, pod.Name)
}
+ ref := normalizedNSOwnerRef(pod.Namespace, controllerRef)
immediateControllerRefs[ref] = struct{}{}
}
Ricky's on PTO for a while. Assigning to you, dan. Tested and verified in v4.2.0-0.nightly-2019-08-20-043744, no panic messages found. [root@dhcp-41-193 FILE]# oc get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE svc-1 ClusterIP 172.30.246.172 <none> 8080/TCP 12s svc-10 ClusterIP 172.30.205.89 <none> 8080/TCP 6s svc-2 ClusterIP 172.30.247.104 <none> 8080/TCP 10s svc-3 ClusterIP 172.30.212.216 <none> 8080/TCP 9s svc-4 ClusterIP 172.30.173.88 <none> 8080/TCP 9s svc-5 ClusterIP 172.30.66.225 <none> 8080/TCP 9s svc-6 ClusterIP 172.30.207.22 <none> 8080/TCP 8s svc-7 ClusterIP 172.30.107.245 <none> 8080/TCP 8s svc-8 ClusterIP 172.30.21.177 <none> 8080/TCP 7s svc-9 ClusterIP 172.30.146.3 <none> 8080/TCP 7s [root@dhcp-41-193 FILE]# oc idle svc-1 WARNING: idling when network policies are in place may cause connections to bypass network policy entirely error: unable to mark the service "p1/svc-1" as idled. Make sure that the service is not already marked as idled and that it is associated with resources that can be scaled. See 'oc idle -h' for help and examples. [root@dhcp-41-193 FILE]# oc get clusterversion NAME VERSION AVAILABLE PROGRESSING SINCE STATUS version 4.2.0-0.nightly-2019-08-20-043744 True False 8m16s Cluster version is 4.2.0-0.nightly-2019-08-20-043744 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:2922 |