cmd/go: Random failures building/running some go1.15.7 unit tests on high-core machines #43907
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
WaitingForInfo
Issue is not actionable because of missing required information, which needs to be provided.
Milestone
On high-core machines (eg 40-core), there seems to be a slice append issue in the latest GCCGO-related fixes to
exec.go:cgo()
when processing the newcgoEnv()
cached slice.What version of Go are you using (
go version
)?This is the latest version which builds, but fails some tests randomly:
It was built using:
Does this issue reproduce with the latest release?
This issue occurs while running the golang toolchain unit tests, building/testing the latest (go1.15.7) release.
What operating system and processor architecture are you using (
go env
)?These are the env results for the go1.15.7 toolchain which was built, but is randomly failing some tests.
go env
OutputWhat did you do?
I picked one test that was failing randomly - TestCrossPackageTests, and ran it in a stress test loop.
The failure seems to be in the go build stage which the test runs, rather than the sub-tests it runs.
Clearing the GOCACHE before each build causes it to occur more frequently.
exporting GOMAXPROCS=2 dramatically reduced the likelihood of it occurring.
What did you expect to see?
The stress test script above should continue to pass.
What did you see instead?
At some random iteration (often in the first 5-15), the stress test script above fails as follows:
The panic is in the
We expect to find the contents of cgoLDFLAGS in flags
check at the end ofcgo
.When I added some trace statements, I found that when it was about to index-out-of-range, it was looking for a longer
cgoLDFLAGS
than was possible with the extractedflags
; the case that I found repeated over all failed runs was when:git bisecting go1.15.6..go1.15.7 lead me to commit e8e7fac
[release-branch.go1.15-security] cmd/go: pass resolved CC, GCCGO to cgo
.(see also https://go-review.googlesource.com/c/go/+/284780/)
Examining this, I noticed some new
append()
s in the diff of the forma = append(b, c)
that looked unsafe (and an append to the returned, cached slice).For testing purposes, I modified
go/src/cmd/go/internal/work/exec.go
to always return a copy.With that change, the stress test completed successfully.
I noticed there is a later change https://go-review.googlesource.com/c/go/+/285873 which reverts much of the GCCGO related change in 1.15.7, so there may already be a fix for this.
The text was updated successfully, but these errors were encountered: