Uploaded image for project: 'OpenShift Bugs'
  1. OpenShift Bugs
  2. OCPBUGS-61083

Runtime error in the datagather_status.go

XMLWordPrintable

    • Quality / Stability / Reliability
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • None
    • None
    • CCXDEV Sprint 150
    • 1
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Description of problem:

      I hit the `panic: runtime error: index out of range [0] with length 0` during tests, and I guess it's a code logic error, and it just appeared accidentally. 

      For more details about this error:

      I0829 08:15:04.140329       1 tasks_processing.go:74] worker 0 stopped.
      I0829 08:15:04.140451       1 recorder.go:70] Recording insights-operator/conditional-gatherer-rules with fingerprint=32e6f695736e68140abe8463566da297d6410ed995690df4834db3e4cf7324ef
      I0829 08:15:04.148563       1 gather.go:183] gatherer "conditional" function "conditional_gatherer_rules" took 1.64µs to process 1 records
      W0829 08:15:04.148712       1 gather.go:215] can't read cgroups memory usage data: open /sys/fs/cgroup/memory/memory.usage_in_bytes: no such file or directory
      I0829 08:15:04.159084       1 recorder.go:70] Recording insights-operator/gathers with fingerprint=6f940582eb228dd8d482f9ea850b7cbbf94ff9901e4074362e0e0113a28a1154
      I0829 08:15:04.167897       1 diskrecorder.go:70] Writing 199 records to /var/lib/insights-operator/insights-2025-08-29-081504.tar.gz
      I0829 08:15:04.185726       1 diskrecorder.go:51] Wrote 199 records to disk in 17ms
      E0829 08:15:04.199073       1 gather_commands.go:213] Operation cannot be fulfilled on datagathers.insights.openshift.io "periodic-gathering-7s9gt": StorageError: invalid object, Code: 4, Key: /kubernetes.io/insights.openshift.io/datagathers/periodic-gathering-7s9gt, ResourceVersion: 0, AdditionalErrorMsg: Precondition failed: UID in precondition: fca71b3c-2edc-4932-a1d6-45ca1c50f5a5, UID in object meta:
      I0829 08:15:04.228012       1 requests.go:47] Uploading application/vnd.redhat.openshift.periodic to https://console.redhat.com/api/ingress/v1/upload
      I0829 08:15:04.797167       1 requests.go:88] Successfully reported id=2025-08-29T08:15:04Z x-rh-insights-request-id=7886edd87f0e46ed83a24cfd0deb7913, wrote=99102
      I0829 08:15:04.797322       1 insightsuploader.go:226] Uploaded report successfully in 598.206363ms
      I0829 08:15:04.797380       1 gather_commands.go:228] Insights archive successfully uploaded with InsightsRequestID: 7886edd87f0e46ed83a24cfd0deb7913
      panic: runtime error: index out of range [0] with length 0goroutine 1 [running]:
      github.com/openshift/insights-operator/pkg/controller/status.UpdateDataGatherConditions({0x30d7df0, 0xc0004c4150}, {0x30b3990, 0xc0009aca40}, 0xc00151ad80, 0xc001c0f3e8)
          /go/src/github.com/openshift/insights-operator/pkg/controller/status/datagather_status.go:106 +0x2e7
      github.com/openshift/insights-operator/pkg/controller.(*GatherJob).GatherAndUpload(0xc00097c500, 0x2c1fb47?, 0x1a?)
          /go/src/github.com/openshift/insights-operator/pkg/controller/gather_commands.go:231 +0x13bd
      github.com/openshift/insights-operator/pkg/cmd/start.NewGatherAndUpload.runGatherAndUpload.func1(0xc000807c00?, {0x2c169e1?, 0x4?, 0x2c169e5?})
          /go/src/github.com/openshift/insights-operator/pkg/cmd/start/start.go:291 +0x5d3
      github.com/spf13/cobra.(*Command).execute(0xc00097ef00, {0xc000961480, 0x2, 0x2})
          /go/src/github.com/openshift/insights-operator/vendor/github.com/spf13/cobra/command.go:944 +0x863
      github.com/spf13/cobra.(*Command).ExecuteC(0xc0008ffb00)
          /go/src/github.com/openshift/insights-operator/vendor/github.com/spf13/cobra/command.go:1068 +0x3a5
      github.com/spf13/cobra.(*Command).Execute(...)
          /go/src/github.com/openshift/insights-operator/vendor/github.com/spf13/cobra/command.go:992
      main.main()
          /go/src/github.com/openshift/insights-operator/cmd/insights-operator/main.go:31 +0x10f 

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

          

      How reproducible:

          Unknown, it's an accidental error, but I think it can be reproduced in the unit test: Add a unit test to test the condition field in the DataGather CRD is None.

      Steps to Reproduce:

          1. Add a unit test to test the scenario that the condition field in the DataGather CRD is None.
          

      Actual results:

          1. The unit test fails due to a runtime error.

      Expected results:

          1. The unit test passes.

      Additional info:

          This problem should be easier to reproduce and test in the unit test, so we won't cover it in the e2e test.

              opokorny@redhat.com Ondrej Pokorny
              rh-ee-bazhou Baiyang Zhou
              None
              None
              Baiyang Zhou Baiyang Zhou
              None
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: