-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: panic: offset too large #55357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Were they building the same source code, or different? That is, is this a nondeterministic failure, or an ICE because the input source code is changed? Thanks. |
@cherrymui sorry, usually different source code. I've lost my scrollback buffer, so I can't say for certain, I believe this compiler panic occurred after making an edit to the source code. But, I did re-run that same source code after the compiler panic occurred and it did (and has not) not panicked. |
Thanks. So it sounds like nondeterministic failure. Maybe next time if you can have some input that can trigger the failure (even nondeterministically), that would be helpful. For that particular panic, I think we only add to |
Yeah, if I can reproduce this again I'll certainly post more information. |
I've been seeing the same issue a few times during the last few days, but with go1.19.2 on linux/amd64.
(This code isn't online yet.) It doesn't do anything special. It does use generics, unlike most Go code I compile much more often without getting this random panic. If it happens again, I'll try a go clean and a rebuild. For me too the next build after this panic (without changing any source files) succeeds as normal. I'm assuming it is OK to see paths pointing to /usr/local even though I don't have any Go toolchain/source there. I keep my go toolchains in $HOME/sdk and that's where I can find the files with linenumbers from the stacktrace. |
I have been able to reproduce this on multiple two more machines with the same code and go1.19.2. Faster machines seem to get to the problem with fewer attempts. My laptop triggers it typically within 200 runs. My macbook pro 2016 darwin/amd64 gets there within 200 runs as well, I got it once over 420 runs on a slower linux/amd64 cloud vm with 2 processors. I have not been able to trigger this on an older linux/386 cloud vm with 1 processor after about 500 runs. On my laptop it didn't yet trigger after 520 runs with GOMAXPROCS=1, and also not after 700 runs with GO19CONCURRENTCOMPILATION=0 (a flag I've seen before, I don't know if this makes sense for this kind of error). My laptops /proc/cpuinfo lists 8 processors of Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz. I have been getting these errors while running "go test", but I've change the _test.go files to regular .go files and just "go build" triggers the same error. I could send the code somewhere. |
@mjl- thanks for the update. It would be great if you could post a reproducer. It is fine if it only fails with 200 runs, or even 2000 runs. I guess there is some sort of race, which is only triggered with some specific input source code. Would you mind also try to see if it fails if you build the compiler with the race detector? That is, |
I'll upload the code in a moment. |
Thanks! It looks to me like that two functions shared a single |
Code is at https://www.ueber.net/who/mjl/tmp/bstore.gorace.tgz |
@mjl- to be clear, how could we reproduce this? I mean running I couldn't reproduce in my Linux. |
I've been running this:
The echo is a simple way to get the new compilation. |
Thanks for the reproducer. With race-detector-enabled compiler I can reproduce pretty consistently (5/5) with Go 1.19, but I cannot reproduce at Go tip with 100 runs. Go tip with My guess is that for some compiler-generated function (possibly wrapper?), the non-unified-IR frontend (incorrectly) generated a shared I'll see whether we can make a fix for the old backend and backport. |
Apparently it has something to do with
if I make the |
CL https://golang.org/cl/443158 seems to fix the race. I'm not really familiar with that code so not sure how correct it is, though. |
Change https://go.dev/cl/443158 mentions this issue: |
@gopherbot please backport this to previous releases. This can cause build failure for valid code. Thanks. |
Backport issue(s) opened: #56359 (for 1.18), #56360 (for 1.19). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases. |
Change https://go.dev/cl/445176 mentions this issue: |
Change https://go.dev/cl/445177 mentions this issue: |
When a function type is copied (e.g. for substituting type parameters), we make copies of its parameter ir.Name nodes, so they are not shared with the old function type. But currently a blank (_) identifier is not copied but shared. The parameter node's frame offset is assigned (in ABI analysis) and then used in the concurrent backend. Shared node can cause a data race. Make a new blank parameter node to avoid sharing. (Unified IR does already not have this problem. This fixes non-unified-IR mode.) This seems to fix golang#55357. Change-Id: Ie27f08e5589ac7d5d3f0d0d5de1a21e4fd2765c9 Reviewed-on: https://go-review.googlesource.com/c/go/+/443158 Reviewed-by: Keith Randall <khr@golang.org> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com>
…ubstituting function type When a function type is copied (e.g. for substituting type parameters), we make copies of its parameter ir.Name nodes, so they are not shared with the old function type. But currently a blank (_) identifier is not copied but shared. The parameter node's frame offset is assigned (in ABI analysis) and then used in the concurrent backend. Shared node can cause a data race. Make a new blank parameter node to avoid sharing. (Unified IR does already not have this problem. This fixes non-unified-IR mode.) Updates #55357. Fixes #56359. Change-Id: Ie27f08e5589ac7d5d3f0d0d5de1a21e4fd2765c9 Reviewed-on: https://go-review.googlesource.com/c/go/+/443158 Reviewed-by: Keith Randall <khr@golang.org> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com> (cherry picked from commit 4725c71) Reviewed-on: https://go-review.googlesource.com/c/go/+/445177
…ubstituting function type When a function type is copied (e.g. for substituting type parameters), we make copies of its parameter ir.Name nodes, so they are not shared with the old function type. But currently a blank (_) identifier is not copied but shared. The parameter node's frame offset is assigned (in ABI analysis) and then used in the concurrent backend. Shared node can cause a data race. Make a new blank parameter node to avoid sharing. (Unified IR does already not have this problem. This fixes non-unified-IR mode.) Updates #55357. Fixes #56360. Change-Id: Ie27f08e5589ac7d5d3f0d0d5de1a21e4fd2765c9 Reviewed-on: https://go-review.googlesource.com/c/go/+/443158 Reviewed-by: Keith Randall <khr@golang.org> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com> (cherry picked from commit 4725c71) Reviewed-on: https://go-review.googlesource.com/c/go/+/445176
…ubstituting function type When a function type is copied (e.g. for substituting type parameters), we make copies of its parameter ir.Name nodes, so they are not shared with the old function type. But currently a blank (_) identifier is not copied but shared. The parameter node's frame offset is assigned (in ABI analysis) and then used in the concurrent backend. Shared node can cause a data race. Make a new blank parameter node to avoid sharing. (Unified IR does already not have this problem. This fixes non-unified-IR mode.) Updates golang#55357. Fixes golang#56360. Change-Id: Ie27f08e5589ac7d5d3f0d0d5de1a21e4fd2765c9 Reviewed-on: https://go-review.googlesource.com/c/go/+/443158 Reviewed-by: Keith Randall <khr@golang.org> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com> (cherry picked from commit 4725c71) Reviewed-on: https://go-review.googlesource.com/c/go/+/445176
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Unsure.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I don't have any sort of repro yet. I've built this project easily hundreds of times with Go 1.19 and this is the first time it's happened. Of course, it hasn't happened in the dozens of test runs since. I know it's not much to work with, but it's probably better to report ICEs than not, right?
The text was updated successfully, but these errors were encountered: