Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic in cue/eval #2524

Closed
verdverm opened this issue Aug 3, 2023 · 4 comments
Closed

panic in cue/eval #2524

verdverm opened this issue Aug 3, 2023 · 4 comments

Comments

@verdverm
Copy link

verdverm commented Aug 3, 2023

What version of CUE are you using (cue version)?

0.6.0-rc.1

What did you do?

exec cue eval daemonset.yaml

-- daemonset.yaml --
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: dagger-engine
  namespace: dagger
  labels:
    k8s-app: dagger-engine
spec:
  selector:
    matchLabels:
      name: dagger-engine
  template:
    metadata:
      labels:
        name: dagger-engine
    spec:
      tolerations:
        - effect: NoSchedule
          key: github-actions-runner
          operator: Exists
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: github-actions-runner
                operator: Exists
      securityContext:
        runAsUser: 0
        runAsGroup: 1001
        fsGroup: 1001
        fsGroupChangePolicy: "OnRootMismatch"
      initContainers:
        - name: download-bin
          image: {{ .Values.dagger.engine.image.repository }}:{{ .Values.dagger.engine.image.tag }}
          command: ["sh", "-c", "wget https://github.com/moby/buildkit/releases/download/v0.11.6/buildkit-v0.11.6.linux-amd64.tar.gz -O /shared-bin/buildkit.tar.gz && tar -xvzf /shared-bin/buildkit.tar.gz --strip-components 1 bin/buildctl -C /shared-bin"]
          volumeMounts:
          - name: shared-bin
            mountPath: /shared-bin
      containers:
        - name: dagger-engine
          image: {{ .Values.dagger.engine.image.repository }}:{{ .Values.dagger.engine.image.tag }}
          imagePullPolicy: Always
          args:
            - "--oci-max-parallelism"
            - "num-cpu"
          {{- if and .Values.dagger.magicache.enabled .Values.dagger.magicache.cloud}}
          env:
          - name: _EXPERIMENTAL_DAGGER_CACHESERVICE_URL
            value: {{ required "A magicache url is required" .Values.dagger.magicache.cloud.url }}
          - name: _EXPERIMENTAL_DAGGER_CACHESERVICE_TOKEN
            value: {{ required "A magicache token is required" .Values.dagger.magicache.cloud.token }}
          {{- end }}
          securityContext:
            privileged: true
            capabilities:
              add:
                - ALL
          readinessProbe:
            exec:
              command: ["/shared-bin/buildctl", "debug", "workers"]
            initialDelaySeconds: 5
            periodSeconds: 5
          volumeMounts:
            - name: varlibdagger
              mountPath: /var/lib/dagger
            - name: varrundagger
              mountPath: /var/run/buildkit
            - name: shared-bin
              mountPath: /shared-bin
      terminationGracePeriodSeconds: 300
      volumes:
        - name: shared-bin
          emptyDir: {}
        - name: varlibdagger
          hostPath:
            path: /var/lib/dagger
        - name: varrundagger
          hostPath:
            path: /var/run/dagger

What did you expect to see?

I was trying to cue import this file, but saw no output or error. So I tried cue eval and got a panic. So I think there may be an error being hidden by cue import as well.

What did you see instead?

$ cue eval daemonset.yaml 
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0xbe3fec]

goroutine 1 [running]:
cuelang.org/go/cmd/cue/cmd.recoverError(0xc0004bbeb8)
        /home/tony/cue/cue/cmd/cue/cmd/root.go:315 +0x7b
panic({0xcb7640, 0x13e2730})
        /usr/local/go/src/runtime/panic.go:884 +0x213
cuelang.org/go/cmd/cue/cmd.(*instance).Value(...)
        /home/tony/cue/cue/cmd/cue/cmd/common.go:206
cuelang.org/go/cmd/cue/cmd.(*instanceIterator).value(0xc0004145b0?)
        /home/tony/cue/cue/cmd/cue/cmd/common.go:223 +0x2c
cuelang.org/go/cmd/cue/cmd.runEval(0xc0003c1230, {0xc0003f84c0, 0x1, 0x1})
        /home/tony/cue/cue/cmd/cue/cmd/eval.go:120 +0x4e4
cuelang.org/go/cmd/cue/cmd.mkRunE.func1(0xc000005b00?, {0xc0003f84c0, 0x1, 0x1})
        /home/tony/cue/cue/cmd/cue/cmd/root.go:87 +0xb3
github.com/spf13/cobra.(*Command).execute(0xc000005b00, {0xc0003f8480, 0x1, 0x1})
        /home/tony/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:940 +0x862
github.com/spf13/cobra.(*Command).ExecuteC(0xc000005200)
        /home/tony/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
        /home/tony/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992
cuelang.org/go/cmd/cue/cmd.(*Command).Run(0xc0003c1230, {0x2?, 0x2?})
        /home/tony/cue/cue/cmd/cue/cmd/root.go:300 +0x6b
cuelang.org/go/cmd/cue/cmd.Main()
        /home/tony/cue/cue/cmd/cue/cmd/root.go:228 +0x79
main.main()
        /home/tony/cue/cue/cmd/cue/main.go:24 +0x19
@verdverm verdverm added NeedsInvestigation Triage Requires triage/attention labels Aug 3, 2023
@mvdan
Copy link
Member

mvdan commented Aug 4, 2023

I am not able to reproduce I'm afraid. With both v0.5.0 and v0.6.0-rc.1, I see:

> exec cue eval daemonset.yaml
[stderr]
$WORK/daemonset.yaml:34: did not find expected key
[exit status 1]
FAIL: /tmp/testscript1420219753/repro-cmd.txtar/script.txtar:1: unexpected command failure

I haven't investigated whether that error is correct or not, but I can't reproduce the panic.

@mvdan mvdan added CannotReproduce and removed Triage Requires triage/attention labels Aug 4, 2023
@mvdan
Copy link
Member

mvdan commented Aug 4, 2023

Also, please remember to fill the entire bug template for bugs like these. Otherwise it's not immediately obvious whether you consider this a regression from v0.5.0 or not.

@verdverm
Copy link
Author

verdverm commented Aug 5, 2023

Apparently I forgot to save the file... 😵‍💫

cue eval empty.yaml panics on an empty file, cue import emtpy.yaml reports no error or exit code

Also the same for a yaml file with only comments

@mvdan
Copy link
Member

mvdan commented Aug 6, 2023

I think you want #1790 then - closing as a duplicate.

@mvdan mvdan closed this as not planned Won't fix, can't repro, duplicate, stale Aug 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants