Closed alecholmez closed 6 days ago
I can provide the source code privately when needed. Thanks!
Thanks @alecholmez - I'll post a comment here once I have a small reproducer from what you shared.
I'm having a similar problem, which @rogpeppe was able to reduce to:
env CUE_EXPERIMENT=evalv3
exec cue eval repro.cue
repro.cue
package repro
#P: c: {
let m = {[string]: _}
x: m
}
a: (#P & {}).c
a: (#P & {}).c
Joining threads - the bug that @nyarly mentions is #3255, and the two panics are not identical but extremely similar, so I suggest we fix 3255 first as it already has a minimal reproducer, and then come back here to see whether it also fixes @alecholmez's code that he shared with us. If it doesn't, I will reduce his reproducer as well.
More than happy to test a fix!
Just a heads up I ran this against v0.10.0-alpha.1 and received a new panic:
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
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=0x2 addr=0x1d0 pc=0x100a72a5c]
goroutine 1 [running]:
cuelang.org/go/internal/core/adt.runTask.func1()
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/sched.go:692 +0xa4
panic({0x10117aca0?, 0x101794ff0?})
/opt/homebrew/Cellar/go/1.22.5/libexec/src/runtime/panic.go:770 +0x124
cuelang.org/go/internal/core/adt.runTask.func1()
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/sched.go:692 +0xa4
panic({0x10117aca0?, 0x101794ff0?})
/opt/homebrew/Cellar/go/1.22.5/libexec/src/runtime/panic.go:770 +0x124
cuelang.org/go/internal/core/adt.(*Vertex).updateArcType(0x1403bed7c20, 0x84?)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/composite.go:321 +0x6c
cuelang.org/go/internal/core/adt.(*nodeContext).getArc(0x1401946ae78?, 0x7e4318?, 0x1?)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/fields.go:323 +0x74
cuelang.org/go/internal/core/adt.(*nodeContext).insertArcCC(0x1403beeb808, 0xad51, 0x0, {0x1400b9d9c40, {0x10125e998, 0x1400086a120}, {0x0, 0x1403bef24b0, 0x0, 0x0, ...}}, ...)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/fields.go:774 +0x9c
cuelang.org/go/internal/core/adt.(*nodeContext).insertArc(...)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/fields.go:753
cuelang.org/go/internal/core/adt.(*nodeContext).scheduleStruct(0x1403beeb808, 0x1400b7811c0, 0x140002b8510, {0x0, 0x1403bef24b0, 0x0, 0x0, 0x0, 0x0, {0x0, ...}})
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/conjunct.go:298 +0xa20
cuelang.org/go/internal/core/adt.(*nodeContext).scheduleConjunct(0x1403beeb808, {0x1400b7811c0, {0x10125e998, 0x1400086a2e0}, {0x0, 0x1403bb92d20, 0x0, 0x0, 0x0, 0x0, ...}}, ...)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/conjunct.go:172 +0x79c
cuelang.org/go/internal/core/adt.(*nodeContext).scheduleConjunct(0x1403beeb808, {0x0, {0x10125e970, 0x1403bb69740}, {0x0, 0x1403bb92c30, 0x0, 0x0, 0x0, 0x0, ...}}, ...)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/conjunct.go:137 +0xf90
cuelang.org/go/internal/core/adt.(*nodeContext).scheduleConjunct(0x1403beeb808, {0x0, {0x10125e970, 0x1403bb69758}, {0x0, 0x1403bb92b40, 0x0, 0x0, 0x1, 0x0, ...}}, ...)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/conjunct.go:137 +0xf90
cuelang.org/go/internal/core/adt.(*nodeContext).scheduleConjunct(0x1403beeb808, {0x0, {0x10125e970, 0x1403bb69770}, {0x0, 0x1403bb92a50, 0x0, 0x0, 0x0, 0x0, ...}}, ...)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/conjunct.go:137 +0xf90
cuelang.org/go/internal/core/adt.(*nodeContext).scheduleConjunct(0x1403beeb808, {0x0, {0x10125e970, 0x1403bb69788}, {0x0, 0x1403bb92960, 0x0, 0x0, 0x0, 0x0, ...}}, ...)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/conjunct.go:137 +0xf90
cuelang.org/go/internal/core/adt.(*nodeContext).scheduleVertexConjuncts(0x1403beeb808, {0x1400b7811c0, {0x10125eab0, 0x14000825840}, {0x0, 0x1403beb14a0, 0x0, 0x0, 0x0, 0x0, ...}}, ...)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/conjunct.go:425 +0x498
cuelang.org/go/internal/core/adt.processResolver(0x1400fddbb00, 0x1403bef4a00, 0xb0?)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/tasks.go:122 +0x394
cuelang.org/go/internal/core/adt.runTask(0x1403bef4a00, 0x4)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/sched.go:712 +0x434
cuelang.org/go/internal/core/adt.(*scheduler).process(0x1403beeb9d8, 0x7eff, 0x4)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/sched.go:411 +0x1dc
cuelang.org/go/internal/core/adt.(*Vertex).unify(0x1403be74140, 0x1400fddbb00, 0x7fff, 0x4)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/unify.go:159 +0x220
cuelang.org/go/internal/core/adt.(*nodeContext).doDisjunct(0x1403bd2ac08, {0x1400b7811c0, {0x10125eab0, 0x14000825840}, {0x0, 0x1403beb14a0, 0x0, 0x0, 0x0, 0x0, ...}}, ...)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/disjunct2.go:441 +0x490
cuelang.org/go/internal/core/adt.(*nodeContext).crossProduct(0x1403bc6f208, {0x1401946d8f8?, 0x1403bc7a690?, 0x1400fddbb00?}, {0x1400b9b1a00, 0x3, 0x1401946d7c8?}, 0x14038402a10, 0x4)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/disjunct2.go:345 +0x2ec
cuelang.org/go/internal/core/adt.(*nodeContext).processDisjunctions(0x1403bc6f208)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/disjunct2.go:279 +0x118
cuelang.org/go/internal/core/adt.processDisjunctions(0x100f6fbde?, 0x1403bc78780, 0x6?)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/tasks.go:189 +0x24
cuelang.org/go/internal/core/adt.runTask(0x1403bc78780, 0x2)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/sched.go:712 +0x434
cuelang.org/go/internal/core/adt.(*scheduler).process(0x1403bc6f3d8, 0x24, 0x2)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/sched.go:411 +0x1dc
cuelang.org/go/internal/core/adt.(*nodeContext).completeNodeTasks(0x1403bc6f208, 0x2)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/unify.go:390 +0x13c
cuelang.org/go/internal/core/adt.runTask.func1()
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/sched.go:678 +0x38
cuelang.org/go/internal/core/adt.runTask(0x1403bc78000, 0x4)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/sched.go:734 +0x5b4
cuelang.org/go/internal/core/adt.(*scheduler).process(0x1403bc6f3d8, 0x7eff, 0x4)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/sched.go:411 +0x1dc
cuelang.org/go/internal/core/adt.(*Vertex).unify(0x1403bc29a40, 0x1400fddbb00, 0x7fff, 0x4)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/unify.go:159 +0x220
cuelang.org/go/internal/core/adt.(*nodeContext).completeAllArcs(0x1403bb7f808, 0x7fff, 0x4)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/unify.go:503 +0x1dc
cuelang.org/go/internal/core/adt.(*Vertex).unify(0x1403bb75040, 0x1400fddbb00, 0x7fff, 0x4)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/unify.go:226 +0x738
cuelang.org/go/internal/core/adt.(*nodeContext).completeAllArcs(0x14022d25208, 0x7fff, 0x4)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/unify.go:503 +0x1dc
cuelang.org/go/internal/core/adt.(*Vertex).unify(0x14022d12e60, 0x1400fddbb00, 0x7fff, 0x4)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/unify.go:226 +0x738
cuelang.org/go/internal/core/adt.(*Vertex).unify(0x14023b0be00, 0x1400fddbb00, 0x7fff, 0x4)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/unify.go:283 +0x9c0
cuelang.org/go/internal/core/adt.(*nodeContext).completeAllArcs(0x14022d24008, 0x7fff, 0x4)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/unify.go:503 +0x1dc
cuelang.org/go/internal/core/adt.(*Vertex).unify(0x14022d12c80, 0x1400fddbb00, 0x7fff, 0x4)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/unify.go:226 +0x738
cuelang.org/go/internal/core/adt.(*nodeContext).completeAllArcs(0x14022d19208, 0x7fff, 0x4)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/unify.go:503 +0x1dc
cuelang.org/go/internal/core/adt.(*Vertex).unify(0x14022d12b40, 0x1400fddbb00, 0x7fff, 0x4)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/unify.go:226 +0x738
cuelang.org/go/internal/core/adt.(*OpContext).unify(0x140003d0000?, 0x0?, 0x1?)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/eval.go:158 +0x320
cuelang.org/go/internal/core/adt.(*Vertex).Finalize(0x1401c79f4b8?, 0x1400fddbb00)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/internal/core/adt/composite.go:816 +0x58
cuelang.org/go/cue.newVertexRoot(0x1400021b740, 0x10921fe88?, 0x14022d12b40)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/cue/types.go:602 +0x2c
cuelang.org/go/cue.newValueRoot(0x0?, 0x1401c79f5d0?, {0x101265c40?, 0x14022d12b40?})
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/cue/types.go:611 +0x3c
cuelang.org/go/cue.(*Context).make(0x1400021b740, 0x14022d12b40)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/cue/context.go:253 +0x8c
cuelang.org/go/cue.(*Context).BuildInstances(0x1400021b740, {0x14000ae8da0, 0x3, 0x14000adf810?})
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/cue/context.go:148 +0x1ac
cuelang.org/go/cmd/cue/cmd.buildInstances(0x14000281ad0, {0x14000ae8da0, 0x3, 0x14000700908?}, 0x0)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/cmd/cue/cmd/common.go:710 +0x38
cuelang.org/go/cmd/cue/cmd.(*buildPlan).instances(0x14000326820)
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/cmd/cue/cmd/common.go:140 +0x44
cuelang.org/go/cmd/cue/cmd.runEval(0x14000281ad0, {0x140002138c0, 0x1, 0x2})
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/cmd/cue/cmd/eval.go:117 +0x2ec
cuelang.org/go/cmd/cue/cmd.newEvalCmd.mkRunE.func1(0x1400018ca00?, {0x140002138c0, 0x1, 0x2})
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/cmd/cue/cmd/root.go:126 +0x1fc
github.com/spf13/cobra.(*Command).execute(0x14000282f08, {0x140002138a0, 0x2, 0x2})
/Users/alecholmes/Developer/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:985 +0x840
github.com/spf13/cobra.(*Command).ExecuteC(0x14000282608)
/Users/alecholmes/Developer/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1117 +0x344
github.com/spf13/cobra.(*Command).Execute(...)
/Users/alecholmes/Developer/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1041
cuelang.org/go/cmd/cue/cmd.(*Command).Run(0x14000281ad0, {0x1018368e0?, 0x10117bcc0?})
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/cmd/cue/cmd/root.go:391 +0x28
cuelang.org/go/cmd/cue/cmd.Main()
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/cmd/cue/cmd/root.go:299 +0x9c
main.main()
/Users/alecholmes/Developer/go/pkg/mod/cuelang.org/go@v0.10.0-alpha.1/cmd/cue/main.go:24 +0x1c
@mvdan This issue seems to be solved with the latest v0.10.0-alpha.2
release but a new bug has been found. I've filed it here:
https://github.com/cue-lang/cue/issues/3325
Thank you @alecholmez - it turns out @nyarly's bug that @rogpeppe filed was a duplicate of https://github.com/cue-lang/cue/issues/3062, which had already been fixed in master in early June, so it makes sense that your panic here was also solved the same way. Given that you opened https://github.com/cue-lang/cue/issues/3325, I think we can close this one now as another duplicate. Thanks!
What version of CUE are you using (
cue version
)?Does this issue reproduce with the latest stable release?
Without the
evalv3
experiment enabled, this does not reproduce. Withevalv3
this can be reproduced.What did you do?
What did you expect to see?
An evaluated project.
What did you see instead?
A panic: