-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: "go list -f '{{.Stale}}'" stack overflow with cyclic imports #25830
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
This issue cannot be reproduced on go1.12.2.
The description above is placing files in |
We got a report via Slack of what seems to be the same crash on Go 1.15.7, with the following cycle in the stack trace: go/src/cmd/go/internal/work/action.go Line 371 in e8e7fac
go/src/cmd/go/internal/work/action.go Line 404 in e8e7fac
go/src/cmd/go/internal/work/action.go Line 414 in e8e7fac
Like the original report — and like #43279 — the top of the stack at the time of the crash was in the |
I'm intrigued by the condition that is supposed to guard against import cycles here: go/src/cmd/go/internal/work/action.go Line 412 in e8e7fac
Perhaps |
I ran into this when analyzing some gVisor code. In particular the package Because |
Reproduced at Thank you! |
Change https://golang.org/cl/301289 mentions this issue: |
Threw together a quick CL with what I imagine is the simplest solution to this problem, feel free to ignore if you think there is a better approach. |
@gopherbot please consider this for backport to 1.16 and 1.15 |
Backport issue(s) opened: #47347 (for 1.15), #47348 (for 1.16). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases. |
Change https://golang.org/cl/336649 mentions this issue: |
Change https://golang.org/cl/336669 mentions this issue: |
…e when in a cycle When hitting an import cycle in reusePackage, and there is already an error set, make sure IsImportCycle is set so that we don't end up stuck in a loop. Updates #25830 Fixes #47347 Change-Id: Iba966aea4a637dfc34ee22782a477209ac48c9bd Reviewed-on: https://go-review.googlesource.com/c/go/+/301289 Trust: Roland Shoemaker <roland@golang.org> Run-TryBot: Roland Shoemaker <roland@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com> Reviewed-by: Jay Conrod <jayconrod@google.com> TryBot-Result: Go Bot <gobot@golang.org> (cherry picked from commit cdd08e6) Reviewed-on: https://go-review.googlesource.com/c/go/+/336669 Trust: Bryan C. Mills <bcmills@google.com> Run-TryBot: Bryan C. Mills <bcmills@google.com>
…e when in a cycle When hitting an import cycle in reusePackage, and there is already an error set, make sure IsImportCycle is set so that we don't end up stuck in a loop. Updates #25830 Fixes #47348 Change-Id: Iba966aea4a637dfc34ee22782a477209ac48c9bd Reviewed-on: https://go-review.googlesource.com/c/go/+/301289 Trust: Roland Shoemaker <roland@golang.org> Run-TryBot: Roland Shoemaker <roland@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com> Reviewed-by: Jay Conrod <jayconrod@google.com> TryBot-Result: Go Bot <gobot@golang.org> (cherry picked from commit cdd08e6) Reviewed-on: https://go-review.googlesource.com/c/go/+/336649 Trust: Bryan C. Mills <bcmills@google.com> Run-TryBot: Bryan C. Mills <bcmills@google.com>
What version of Go are you using (
go version
)?go version go1.10.3 linux/amd64
Does this issue reproduce with the latest release?
Yes. We also saw this with 1.10.2.
What operating system and processor architecture are you using (
go env
)?What did you do?
This appears to be triggered by any cyclic import, but only with use of the
{{.Stale}}
template, e.g.:What did you expect to see?
An error message about the cyclic import, but no crash.
What did you see instead?
A stack overflow:
etc.
The text was updated successfully, but these errors were encountered: