You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
generating go module: bare
writing dagger.gen.go
writing go.mod
writing go.sum
running post-command: go mod tidy
needs another pass...
Error: generate code: template: module.go.tmpl:79:3: executing "_dagger.gen.go/module.go.tmpl" at <ModuleMainSrc>: error calling ModuleMainSrc: exected DaggerObject to be *types.Interface, but got *types.Basic
This is bizarre, DaggerObject is not a basic type, it's an interface - need to investigate more - I suspect that it's an unknown type (which is a basic type for some reason).
Opened #8214 to try and narrow down the possibilities:
Is is actually an unknown type?
Do internal/ packages actually exist at the time of the bad dagger call? And do they have the expected contents?
Are internal/ files getting weirdly regenerated by go formatting of imports?
Potentially, we're hitting something really weird, and causing some weird race condition in the go build cache? Otherwise, really stretching to imagine what could possibly be going on.
Note - this doesn't look like something in the dagger engine going wrong, like confusing the caching on different sets of files, we're actually running all of this within a single codegen pass.
It took absolutely forever to repro in my debugging PR when I was just re-running every engine test workflow over and over (i.e. re-running all engine tests suites in parallel)
BUT it seems to repro much easier if I instead push an empty commit, which triggers every workflow (including non-engine-test ones)...
Aligns with this possibly being some sort of race condition that's more likely to happen when the engine's host is under extra load? Otherwise I don't see how other workflows could be related
Sounds similar to what you saw with tests using the module name "bare" hitting this simultaneously @jedevc
Don't know what to make of this yet. As mentioned above, I didn't see that any file contents were incorrect.
One thing I'm going to try: see if this is reproducible with go mod cache + go build cache not on a shared cache volume. All these modules have the same module name, so like Justin mentioned in the issue description above, wouldn't rule out something being broken here
I was looking through golang/go issues; did not find any exact matches but I did find some pretty recent issues for bugs in this general area around type aliases (which are relevant since DaggerObject goes through two levels of type aliasing before it gets to the "real" definition)
So while not precisely what we're facing, this at least increases the plausibility of there being a bug in the go tooling that would be breaking this. Unfortunately I have no clue how we'd make a simple repro for a go issue at this time, would require a lot of boiling down to something simpler.
I screwed up the type to print out, so updated it in #8267.
But at least, this reveals we did write the right internal/dagger/dagger.gen.go file. It's not something insane like the file doesn't get written.
see if this is reproducible with go mod cache + go build cache not on a shared cache volume
This is a good idea - especially given findings around the Python uv stuff, it doesn't seem impossible that this could be a new issue. Very much hoping it's not this, but at least might give us more of a hint and we could try and repro with more native go tooling.
I decided to try a few things before resorting to trying to disable the cache volume. Main reason being that disabling that is likely to slow things down so much that A) it will take forever to get enough runs to know if it actually fixed the problem B) it should be avoided at all costs as a solution due to the performance hit.
Things I'm trying first:
Currently - upgrading golang/x/tools to the latest version (v0.22 -> v0.24)
If that doesn't work, try simplifying the level of type aliases we have setup (on the hunch there's a bug in the tooling due to our multi-level aliasing)
Merged the update to x/tools, have not seen the same error since across 5+ runs. Not gonna declare certain victory yet, which would displease the gods, but maybe it was a bug in that library afterall?
Error: failed to generate code: input: moduleSource.withName.withSDK.withInit.withSourceSubpath.resolveFromCaller resolve: failed to collect local module source deps: failed to load sdk: failed to load embedded sdk module "python": select: failed to initialize module: failed to call module "python-sdk" to get functions: call constructor: process "go build -o /runtime ." did not complete successfully: exit code: 1
Stderr:
internal/dagger/dagger.gen.go:23:2: package dagger/foo/internal/querybuilder is not in std (/usr/local/go/src/dagger/foo/internal/querybuilder)
internal/dagger/dagger.gen.go:24:2: package dagger/foo/internal/telemetry is not in std (/usr/local/go/src/dagger/foo/internal/telemetry)
So I wonder if the dep upgrade fixed/tweaked something and just unlocked a different problem? Hopefully I can repro this one again soon with a sleep in place so I can jump into the container and look at what's going wrong.
Activity
jedevc commentedon Aug 22, 2024
Hm, just noticed that the places that this flakes in corresponds to where we use the go sdk with
--name=barepretty clearly -TestGitandTestGoInit.sipsma commentedon Aug 29, 2024
Made some minor progress with this:
DaggerObjectgoes through two levels of type aliasing before it gets to the "real" definition)jedevc commentedon Aug 29, 2024
More verbosity reveals https://dagger.cloud/dagger/traces/afb638a78986ca43d0e8a8bb1e975f48#a732981c3df31b7e:L49:
I screwed up the type to print out, so updated it in #8267.
But at least, this reveals we did write the right
internal/dagger/dagger.gen.gofile. It's not something insane like the file doesn't get written.This is a good idea - especially given findings around the Python uv stuff, it doesn't seem impossible that this could be a new issue. Very much hoping it's not this, but at least might give us more of a hint and we could try and repro with more native go tooling.
sipsma commentedon Aug 29, 2024
I decided to try a few things before resorting to trying to disable the cache volume. Main reason being that disabling that is likely to slow things down so much that A) it will take forever to get enough runs to know if it actually fixed the problem B) it should be avoided at all costs as a solution due to the performance hit.
Things I'm trying first:
golang/x/toolsto the latest version (v0.22 -> v0.24)sipsma commentedon Aug 30, 2024
Merged the update to x/tools, have not seen the same error since across 5+ runs. Not gonna declare certain victory yet, which would displease the gods, but maybe it was a bug in that library afterall?
Interestingly, I did hit different errors we used to see from time to time but personally I haven't hit in a few weeks: https://dagger.cloud/dagger/traces/6031bb6348e5b78863ccd386abe7076a
A few tests there failing with errors like:
So I wonder if the dep upgrade fixed/tweaked something and just unlocked a different problem? Hopefully I can repro this one again soon with a sleep in place so I can jump into the container and look at what's going wrong.
sipsma commentedon Aug 30, 2024
Ah, nevermind, still saw that error on main: https://dagger.cloud/dagger/traces/c5bc486ce9aa76ed770a877301119cd4?span=858b61b06da1ffe4
Falling back to seeing if simplifying the multi-level aliasing avoids it.
sipsma commentedon Aug 30, 2024
I managed to find what looks like definitive proof of a bug in go build caching for these separate flakes: #8031 (comment)
Could be unrelated to these ones, but wouldn't shock me if it is the same or similar root cause
jedevc commentedon Sep 5, 2024
This seems to have miraculously disappeared. I guess #8289 massaged things every so slightly, and the issue went away.
🎉 worrying, but oh well, hopefully this is similar-enough to the upstream go issue 👀