Skip to content

[Bug] Invalid Memory in antivirus container - nil pointer dereference #1998

@suse-coder

Description

@suse-coder

Describe the bug

I have the latest opencloud RC 4.0.0 running (in the older one it was working) and when I deploy it I get the error:

antivirus container:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x557fcd388ead]
goroutine 1 [running]:
github.com/opencloud-eu/opencloud/services/antivirus/pkg/command.Server.func2(0xc0008c0380)
github.com/opencloud-eu/opencloud/services/antivirus/pkg/command/server.go:45 +0x26d
github.com/urfave/cli/v2.(*Command).Run(0xc0012ad1e0, 0xc0008c0380, {0xc0008f4320, 0x1, 0x1})
github.com/urfave/cli/v2@v2.27.7/command.go:276 +0x7c2
github.com/urfave/cli/v2.(*Command).Run(0xc0012ad600, 0xc0008c02c0, {0xc0008b2680, 0x2, 0x2})
github.com/urfave/cli/v2@v2.27.7/command.go:269 +0xa30
github.com/urfave/cli/v2.(*Command).Run(0xc0008d6160, 0xc0008c0200, {0xc0000529f0, 0x3, 0x3})
github.com/urfave/cli/v2@v2.27.7/command.go:269 +0xa30
github.com/urfave/cli/v2.(*App).RunContext(0xc0012a2200, {0x557fd083c9a8, 0xc000de6500}, {0xc0000529f0, 0x3, 0x3})
github.com/urfave/cli/v2@v2.27.7/app.go:333 +0x5a5
github.com/opencloud-eu/opencloud/opencloud/pkg/command.Execute()
github.com/opencloud-eu/opencloud/opencloud/pkg/command/root.go:32 +0x1e5
main.main()
github.com/opencloud-eu/opencloud/opencloud/cmd/opencloud/main.go:11 +0x13
apiVersion: v1
kind: Pod
metadata:
  creationTimestamp: "2025-12-09T10:55:47Z"
  generateName: antivirus-5ffb79c75c-
  labels:
    app: antivirus
    app.kubernetes.io/instance: opencloud-gwis
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: opencloud-microservices
    app.kubernetes.io/version: 4.0.0
    helm.sh/chart: opencloud-microservices-0.3.12_72bde002f4ee
    pod-template-hash: 5ffb79c75c
  name: antivirus-5ffb79c75c-dbdfr
  namespace: opencloud-gwis
  ownerReferences:
  - apiVersion: apps/v1
    blockOwnerDeletion: true
    controller: true
    kind: ReplicaSet
    name: antivirus-5ffb79c75c
    uid: 50e8cd3e-1b88-4771-af84-17649867a53e
  resourceVersion: "144034542"
  uid: 3cb04a0f-10cd-48ef-9e2f-d47ad03897c4
spec:
  containers:
  - args:
    - antivirus
    - server
    command:
    - opencloud
    env:
    - name: MICRO_REGISTRY
      value: nats-js-kv
    - name: MICRO_REGISTRY_ADDRESS
      value: nats:9233
    - name: OC_EVENTS_ENDPOINT
      value: nats:9233
    - name: ANTIVIRUS_LOG_COLOR
      value: "false"
    - name: ANTIVIRUS_LOG_LEVEL
      value: debug
    - name: ANTIVIRUS_LOG_PRETTY
      value: "false"
    - name: ANTIVIRUS_DEBUG_ADDR
      value: 0.0.0.0:9277
    - name: ANTIVIRUS_DEBUG_PPROF
      value: "false"
    - name: ANTIVIRUS_INFECTED_FILE_HANDLING
      value: abort
    - name: ANTIVIRUS_SCANNER_TYPE
      value: clamav
    - name: ANTIVIRUS_CLAMAV_SOCKET
      value: tcp://clamav.clamav.svc.cluster.local:3310
    - name: ANTIVIRUS_ICAP_SCAN_TIMEOUT
      value: "300"
    - name: ANTIVIRUS_ICAP_URL
      value: http://clamav-icap.clamav:1344
    - name: ANTIVIRUS_ICAP_SERVICE
      value: avscan
    - name: ANTIVIRUS_MAX_SCAN_SIZE
    - name: ANTIVIRUS_WORKERS
      value: "10"
    image: opencloudeu/opencloud-rolling:4.0.0
    imagePullPolicy: IfNotPresent
    livenessProbe:
      failureThreshold: 3
      httpGet:
        path: /healthz
        port: metrics-debug
        scheme: HTTP
      initialDelaySeconds: 60
      periodSeconds: 20
      successThreshold: 1
      timeoutSeconds: 10
    name: antivirus
    ports:
    - containerPort: 9277
      name: metrics-debug
      protocol: TCP
    resources: {}
    securityContext:
      readOnlyRootFilesystem: true
      runAsGroup: 1000
      runAsNonRoot: true
      runAsUser: 1000
    terminationMessagePath: /dev/termination-log
    terminationMessagePolicy: File
    volumeMounts:
    - mountPath: /etc/opencloud/messaging-system-ca
      name: messaging-system-ca
      readOnly: true
    - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
      name: kube-api-access-5q64r
      readOnly: true
  dnsPolicy: ClusterFirst
  enableServiceLinks: true
  nodeName: talos-worker-0
  preemptionPolicy: PreemptLowerPriority
  priority: 0
  restartPolicy: Always
  schedulerName: default-scheduler
  securityContext:
    fsGroup: 1000
    fsGroupChangePolicy: OnRootMismatch
  serviceAccount: default
  serviceAccountName: default
  terminationGracePeriodSeconds: 30
  tolerations:
  - effect: NoExecute
    key: node.kubernetes.io/not-ready
    operator: Exists
    tolerationSeconds: 300
  - effect: NoExecute
    key: node.kubernetes.io/unreachable
    operator: Exists
    tolerationSeconds: 300
  volumes:
  - emptyDir: {}
    name: messaging-system-ca
  - name: kube-api-access-5q64r
    projected:
      defaultMode: 420
      sources:
      - serviceAccountToken:
          expirationSeconds: 3607
          path: token
      - configMap:
          items:
          - key: ca.crt
            path: ca.crt
          name: kube-root-ca.crt
      - downwardAPI:
          items:
          - fieldRef:
              apiVersion: v1
              fieldPath: metadata.namespace
            path: namespace
status:
  conditions:
  - lastProbeTime: null
    lastTransitionTime: "2025-12-09T10:55:49Z"
    status: "True"
    type: PodReadyToStartContainers
  - lastProbeTime: null
    lastTransitionTime: "2025-12-09T10:55:47Z"
    status: "True"
    type: Initialized
  - lastProbeTime: null
    lastTransitionTime: "2025-12-09T10:55:47Z"
    message: 'containers with unready status: [antivirus]'
    reason: ContainersNotReady
    status: "False"
    type: Ready
  - lastProbeTime: null
    lastTransitionTime: "2025-12-09T10:55:47Z"
    message: 'containers with unready status: [antivirus]'
    reason: ContainersNotReady
    status: "False"
    type: ContainersReady
  - lastProbeTime: null
    lastTransitionTime: "2025-12-09T10:55:47Z"
    status: "True"
    type: PodScheduled
  containerStatuses:
  - containerID: containerd://f5e4130885db5deb7427f0d38bfbd372d036f75457bde6d67f21b575abc9e1bd
    image: docker.io/opencloudeu/opencloud-rolling:4.0.0
    imageID: docker.io/opencloudeu/opencloud-rolling@sha256:1cbce735bfdde97d38422a52b92104dfd2fd320e2e3febc05314b00d6d115d7e
    lastState:
      terminated:
        containerID: containerd://f5e4130885db5deb7427f0d38bfbd372d036f75457bde6d67f21b575abc9e1bd
        exitCode: 2
        finishedAt: "2025-12-09T10:56:32Z"
        reason: Error
        startedAt: "2025-12-09T10:56:32Z"
    name: antivirus
    ready: false
    restartCount: 3
    started: false
    state:
      waiting:
        message: back-off 40s restarting failed container=antivirus pod=antivirus-5ffb79c75c-dbdfr_opencloud-gwis(3cb04a0f-10cd-48ef-9e2f-d47ad03897c4)
        reason: CrashLoopBackOff
    volumeMounts:
    - mountPath: /etc/opencloud/messaging-system-ca
      name: messaging-system-ca
      readOnly: true
      recursiveReadOnly: Disabled
    - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
      name: kube-api-access-5q64r
      readOnly: true
      recursiveReadOnly: Disabled
  hostIP: 192.168.0.235
  hostIPs:
  - ip: 192.168.0.235
  phase: Running
  podIP: 10.244.4.73
  podIPs:
  - ip: 10.244.4.73
  qosClass: BestEffort
  startTime: "2025-12-09T10:55:47Z"

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions