Engine panic in Container.AttachDependencyResultsKinds while resolving Go.env
Summary
The test-split:test-interface CI check panicked while resolving Go.env:
panic while resolving Go.env: runtime error: index out of range [2] with length 2Trace ID: 747d6720abca0470be378b52598715d8
Inspect with:
dagger trace 747d6720abca0470be378b52598715d8Stack
The first application frame is:
github.com/dagger/dagger/core.(*Container).AttachDependencyResultsKinds
/app/core/container.go:1141
github.com/dagger/dagger/dagql.(*Cache).attachDependencyResults
/app/dagql/cache.go:4785
github.com/dagger/dagger/dagql.(*Cache).initCompletedResult
/app/dagql/cache.go:4712The DagQL resolver recovered the panic in dagql.(*Server).resolvePath and reported it as an internal check error.
Suspected cause
AttachDependencyResultsKinds iterates and indexes the mutable field separately:
for i := range container.Mounts {
mnt := &container.Mounts[i]
}For iteration i == 2 to panic with a current length of 2, the loop must have captured a longer slice before container.Mounts was replaced or shortened. Lazy container materialization assigns a cloned mount slice to the same field, so this looks like unsynchronized concurrent or re-entrant evaluation/attachment of a shared cached container result.
Go.env appears to be the resolver that exposed the race rather than the source of the invalid index.
Context
- Check:
test-split:test-interface - PR where observed: #14109
- PR head:
e75f6d9bb2bf7a2e677b836eb0575ffa1c749f45 - Current main inspected:
371244c89e9a754096c440dd97e00aa8a1c25031 - The relevant
core/container.go,dagql/cache.go, and lazy-state code is unchanged by #14109, so this appears to be a pre-existing engine race. - The failure is scheduling/cache-state dependent and was found during a CI rerun.
Expected behavior
Concurrent or re-entrant lazy evaluation and dependency attachment must not mutate a container mount slice while it is being traversed. The resolver should return normally or report a regular error rather than panic.
Source: dagger/dagger