Repository navigation
core: support GODEBUG as system env var + disable go mod index in CI tests - #8470
Conversation
|
Hmm... all the CI test workflows timed out with changing the mode to Locked, so I'm gonna rule that out as non-viable in terms of the performance impact for now. I will try mode Private instead |
|
There does seem to be meaningful slowdown with Private cache volume mode, though not as devastating as with Locked (some workflows seem like a minute slower, though noisy so hard to really tell yet). @rajatjindal had the good suggestion to try disabling the module index as go devs did in the upstream issue (golang/go#69179 (comment)) so will give that a shot too to see what the practical impact is |
|
Hm disabling the module index doesn't appear to have much effect on the runtime across a few runs so far 🤷♂️🎉 I asked the go devs what the implications are of I'm a little wary of setting undocumented feature-flags in our production code, but we could make this a system env var (similar to our existing support for I'll setup the plumbing for that here and do some more re-runs while waiting to hear back from them. |
GODEBUG=goindex=0 is an undocumented feature flag that disabled Go's internal module index. In an upstream issue we opened with Go around a bug in build caching that's impacting us, they used it to workaround the bug. This change thus adds support for GODEBUG as a system env var (similar to our support for GOPROXY) and uses that to set goindex=0 just in our CI test suite for now. This bug seems to only happen under extreme use cases such as our CI where we're running many, many go module builds, which is why this change is only being used in our CI so far (as opposed to setting GODEBUG=goindex=0 for all production users by default). If this ends up impacting real-world users and we get confirmation from the Go devs that setting this feature flag doesn't cause any subtle problems, we can consider setting it by default too. Hopefully though the upstream bug is just fixed and we can undo all this. Signed-off-by: Erik Sipsma <[email protected]>
be317ae to
3845357
Compare
|
|
|
I'll keep pressing re-run when I open this tab, but I've done a bunch of re-runs now without any occurrence of the flake and without any noticeable slowdown, so will take out of draft. Would be nice to hear back from the go devs on my question about the implications of disabling the module index but I think since this change is scoped to purely our CI tests I'd be okay merging at this point, let me know if anyone disagrees. |
|
Yeah, glancing through the source code for the mod index (which is wayyyy more complex than I have time to dive into right now), it's just a cache for https://pkg.go.dev/go/build#Context.Import - if the cache is disabled, we just fetch this data from the filesystem each time. If we don't see a meaningful performance drop in the test runtime, no objection here, since the flakes are reasonably blocking - though obviously let's follow the upstream issue and help out where we can. One thing that did stand out weirdly to me though: https://github.com/golang/go/blob/64a5d1d7de14ad74b1a77614de0e17c659ef12b6/src/cmd/go/internal/modindex/read.go#L73-L77 This feels very very similar to the case we saw for uv in #7662 (comment). Because everything is mounted at @sipsma WDYT about trying our python fix for go, and seeing if that improves the flakes? That feels potentially a bit less invasive, and also if it is that, would help narrow down the go investigation as well? Approving regardless though, will let you make the call here! |
|
@jedevc good find, that's definitely suspicious! I think what I'll do is merge this one as is and open a follow-up PR where I try replacing this approach with that one. The main reasons being that A) I'd like to get a potential fix out ASAP and B) I think the other approach actually is (debatably) more invasive in that it's a meaningful change to the production code (whereas this one does it in such a way that only our test suite will have the module index disabled for now). |
Normalized Git trees can keep the same package paths, file sizes and mtimes across different source contents. Go then reuses a stale import index from the shared GOCACHE, even when source bytes and go.mod are correct. Extend the goindex=0 mitigation from dagger#8470 to Go.Env, including the outer dev-engine build. Preserve existing GODEBUG options and shared compiled-artifact and module-download caches. See dagger#8031 and golang/go#69179. Signed-off-by: Erik Sipsma <[email protected]>
Trying out a possible mitigation to #8031 (which is pending on an upstream go issue).
In a previous iteration, this PR was changing the go cache volume mount mode, but that seemed to have too many performance deficiencies (see comment trail on this PR below).
Disabling the go mod index seems more promising, so going with that now.
GODEBUG=goindex=0 is an undocumented feature flag that disabled Go's
internal module index. In an upstream issue we opened with Go around a
bug in build caching that's impacting us, they used it to workaround the
bug.
This change thus adds support for GODEBUG as a system env var (similar
to our support for GOPROXY) and uses that to set goindex=0 just in our
CI test suite for now.
This bug seems to only happen under extreme use cases such as our CI
where we're running many, many go module builds, which is why this
change is only being used in our CI so far (as opposed to setting
GODEBUG=goindex=0 for all production users by default).
If this ends up impacting real-world users and we get confirmation from
the Go devs that setting this feature flag doesn't cause any subtle
problems, we can consider setting it by default too. Hopefully though
the upstream bug is just fixed and we can undo all this.
Signed-off-by: Erik Sipsma [email protected]