cue icon indicating copy to clipboard operation
cue copied to clipboard

evaluator: panic: incDependent: already closed

Open rogpeppe opened this issue 1 year ago • 1 comments

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

v0.9.2

Does this issue reproduce with the latest stable release?

Yes

What did you do?

TBD

What did you expect to see?

TBD

What did you see instead?

panic: incDependent: already closed: 0xc032435b30
goroutine 1 [running]:
cuelang.org/go/internal/core/adt.runTask.func1()
        /home/judson/golang/pkg/mod/cuelang.org/[email protected]/internal/core/adt/sched.go:692 +0x76
panic({0xa55380?, 0xc022d7fb50?})
        /nix/store/3cm68m84qcwr9bwlpzsnxpss9swzl724-go-1.21.6/share/go/src/runtime/panic.go:914 +0x21f
cuelang.org/go/internal/core/adt.(*closeContext).incDependent(0xc0320ac3c0, 0xc000100400?, 0xc03287bcc0?, 0x0?)
        /home/judson/golang/pkg/mod/cuelang.org/[email protected]/internal/core/adt/fields.go:533 +0xa9
cuelang.org/go/internal/core/adt.(*scheduler).insertTask(0xc0320a99d0, 0xc03287bcc0)
        /home/judson/golang/pkg/mod/cuelang.org/[email protected]/internal/core/adt/sched.go:638 +0xe5
cuelang.org/go/internal/core/adt.(*nodeContext).scheduleTask(...)
        /home/judson/golang/pkg/mod/cuelang.org/[email protected]/internal/core/adt/states.go:309
cuelang.org/go/internal/core/adt.(*nodeContext).scheduleStruct(0xc0320a9800, 0xc032081e80, 0xc002e3a120, {0x0, 0xc0320ac3c0, 0x0, 0x0, 0x0, 0x0, {0x0, ...}})
        /home/judson/golang/pkg/mod/cuelang.org/[email protected]/internal/core/adt/conjunct.go:326 +0x11a5
cuelang.org/go/internal/core/adt.(*nodeContext).scheduleConjunct(0xc0320a9800, {0xc032081e80, {0xc39c30, 0xc002e3a120}, {0x0, 0xc0320aa0f0, 0x0, 0x0, 0x0, 0x0, ...}}, ...)
        /home/judson/golang/pkg/mod/cuelang.org/[email protected]/internal/core/adt/conjunct.go:172 +0x8cf
cuelang.org/go/internal/core/adt.(*nodeContext).scheduleVertexConjuncts(0xc0320a9800, {0xc032081e80, {0xc39ef8, 0xc002e2f060}, {0x0, 0xc0320ac3c0, 0x0, 0x0, 0x0, 0x0, ...}}, ...)
        /home/judson/golang/pkg/mod/cuelang.org/[email protected]/internal/core/adt/conjunct.go:425 +0x685
cuelang.org/go/internal/core/adt.(*nodeContext).unshare(0xc0320b7ef0?)
        /home/judson/golang/pkg/mod/cuelang.org/[email protected]/internal/core/adt/share.go:48 +0x135
cuelang.org/go/internal/core/adt.(*nodeContext).scheduleConjunct(0xc0320a9800, {0xc032081fa0, {0xc39c30, 0xc002e3a120}, {0x0, 0xc0320aa0f0, 0x0, 0x0, 0x0, 0x0, ...}}, ...)
        /home/judson/golang/pkg/mod/cuelang.org/[email protected]/internal/core/adt/conjunct.go:171 +0x88c
cuelang.org/go/internal/core/adt.(*nodeContext).scheduleVertexConjuncts(0xc0320a9800, {0xc032081fa0, {0xc39ef8, 0xc002e2f060}, {0x0, 0xc0320b7ef0, 0x0, 0x0, 0x0, 0x0, ...}}, ...)
        /home/judson/golang/pkg/mod/cuelang.org/[email protected]/internal/core/adt/conjunct.go:425 +0x685
cuelang.org/go/internal/core/adt.processResolver(0xc032081fa0?, 0xc03287bc20, 0x60?)
        /home/judson/golang/pkg/mod/cuelang.org/[email protected]/internal/core/adt/tasks.go:122 +0x3ff
cuelang.org/go/internal/core/adt.runTask(0xc03287bc20, 0x0?)
        /home/judson/golang/pkg/mod/cuelang.org/[email protected]/internal/core/adt/sched.go:712 +0x525
cuelang.org/go/internal/core/adt.(*scheduler).process(0xc0320a99d0, 0x7eff, 0x4)
        /home/judson/golang/pkg/mod/cuelang.org/[email protected]/internal/core/adt/sched.go:411 +0x23d
cuelang.org/go/internal/core/adt.(*Vertex).unify(0xc032098fa0, 0xc002d8c300, 0x7fff, 0x4)
        /home/judson/golang/pkg/mod/cuelang.org/[email protected]/internal/core/adt/unify.go:159 +0x305
cuelang.org/go/internal/core/adt.(*nodeContext).completeAllArcs(0xc03208b800, 0x6905?, 0xb?)
        /home/judson/golang/pkg/mod/cuelang.org/[email protected]/internal/core/adt/unify.go:503 +0x230
cuelang.org/go/internal/core/adt.(*Vertex).unify(0xc032077900, 0xc002d8c300, 0x7fff, 0x4)
        /home/judson/golang/pkg/mod/cuelang.org/[email protected]/internal/core/adt/unify.go:226 +0x906
cuelang.org/go/internal/core/adt.(*nodeContext).completeAllArcs(0xc032082600, 0xd505?, 0x8?)
        /home/judson/golang/pkg/mod/cuelang.org/[email protected]/internal/core/adt/unify.go:503 +0x230
cuelang.org/go/internal/core/adt.(*Vertex).unify(0xc0320770e0, 0xc002d8c300, 0x7fff, 0x4)
        /home/judson/golang/pkg/mod/cuelang.org/[email protected]/internal/core/adt/unify.go:226 +0x906
cuelang.org/go/internal/core/adt.(*nodeContext).completeAllArcs(0xc030601200, 0xfd05?, 0x7?)
        /home/judson/golang/pkg/mod/cuelang.org/[email protected]/internal/core/adt/unify.go:503 +0x230
cuelang.org/go/internal/core/adt.(*Vertex).unify(0xc0305e7d60, 0xc002d8c300, 0x7fff, 0x4)
        /home/judson/golang/pkg/mod/cuelang.org/[email protected]/internal/core/adt/unify.go:226 +0x906
cuelang.org/go/internal/core/adt.(*nodeContext).completeAllArcs(0xc002837800, 0x4705?, 0x83?)
        /home/judson/golang/pkg/mod/cuelang.org/[email protected]/internal/core/adt/unify.go:503 +0x230
cuelang.org/go/internal/core/adt.(*Vertex).unify(0xc000165ae0, 0xc002d8c300, 0x7fff, 0x4)
        /home/judson/golang/pkg/mod/cuelang.org/[email protected]/internal/core/adt/unify.go:226 +0x906
cuelang.org/go/internal/core/adt.(*nodeContext).completeAllArcs(0xc00030a600, 0x6005?, 0x82?)
        /home/judson/golang/pkg/mod/cuelang.org/[email protected]/internal/core/adt/unify.go:503 +0x230
cuelang.org/go/internal/core/adt.(*Vertex).unify(0xc0029a39a0, 0xc002d8c300, 0x7fff, 0x4)
        /home/judson/golang/pkg/mod/cuelang.org/[email protected]/internal/core/adt/unify.go:226 +0x906
cuelang.org/go/internal/core/adt.(*OpContext).unify(0x10a5cc8?, 0x426d05?, 0x3ddb7a0?)
        /home/judson/golang/pkg/mod/cuelang.org/[email protected]/internal/core/adt/eval.go:158 +0x386
cuelang.org/go/internal/core/adt.(*Vertex).Finalize(0x10abaa0?, 0xc002d8c300)
        /home/judson/golang/pkg/mod/cuelang.org/[email protected]/internal/core/adt/composite.go:816 +0x59
cuelang.org/go/cue.newVertexRoot(0x41f576?, 0x10abaa0?, 0xc003ddb840?)
        /home/judson/golang/pkg/mod/cuelang.org/[email protected]/cue/types.go:602 +0x25
cuelang.org/go/cue.newValueRoot(0x0?, 0xc003ddb900?, {0xc3dd80?, 0xc0029a39a0?})
        /home/judson/golang/pkg/mod/cuelang.org/[email protected]/cue/types.go:611 +0x3e
cuelang.org/go/cue.(*Context).make(0xc002bb0280, 0x0?)
        /home/judson/golang/pkg/mod/cuelang.org/[email protected]/cue/context.go:257 +0x8c
cuelang.org/go/cue.(*Context).BuildInstances(0xc002bb0280, {0xc003507330, 0x1, 0x0?})
        /home/judson/golang/pkg/mod/cuelang.org/[email protected]/cue/context.go:152 +0x1dd
main.loadValues({0xc0002950c0?, 0xa5ede0?, 0xc0000ce410?}, 0x7f740ae118e0?)
        /home/judson/dev/YM/tierzero-cluster/clustertool/main.go:144 +0x1c8
main.doBuild({0xc0002950c0?, 0x8?, 0xc0002dfc40?}, {0x7ffe1b23f127, 0x2a}, 0x0?)
        /home/judson/dev/YM/tierzero-cluster/clustertool/main.go:109 +0x32
main.process(0xc0001b8800?, {0xc0002950c0, 0x1, 0x4})
        /home/judson/dev/YM/tierzero-cluster/clustertool/main.go:90 +0x375
github.com/spf13/cobra.(*Command).execute(0x106f720, {0xc0000360b0, 0x4, 0x4})
        /home/judson/golang/pkg/mod/github.com/spf13/[email protected]/command.go:983 +0xabc
github.com/spf13/cobra.(*Command).ExecuteC(0x106f720)
        /home/judson/golang/pkg/mod/github.com/spf13/[email protected]/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
        /home/judson/golang/pkg/mod/github.com/spf13/[email protected]/command.go:1039
main.main()
        /home/judson/dev/YM/tierzero-cluster/clustertool/main.go:368 +0x153

As reported by Judson Lester on Slack

rogpeppe avatar Jun 28 '24 17:06 rogpeppe

Note that this is extremely similar to https://github.com/cue-lang/cue/issues/3249, and with that issue we already have a large private reproducer which I'm reducing once I'm back from holiday. I would definitely suggest we look at that one first, given there's a decent chance this one is a duplicate.

Also, since this issue has no reproduction steps or code, I think it's premature to assign Marcel.

mvdan avatar Jun 29 '24 22:06 mvdan

Here's a minimized reproducer (thanks to Judson Lester for the starting point!):

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

rogpeppe avatar Jul 01 '24 20:07 rogpeppe

It looks like this got fixed by https://review.gerrithub.io/c/cue-lang/cue/+/1195897, which had already been merged to master for over two weeks by the time this issue was created. It would have been good to double check with master right away :) Hence a duplicate of #3062.

mvdan avatar Jul 25 '24 08:07 mvdan