Skip to content
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

cmd/go: go get ./... loops infinitely with specific go.mod, go.sum #52508

Closed
arbourd opened this issue Apr 22, 2022 · 4 comments
Closed

cmd/go: go get ./... loops infinitely with specific go.mod, go.sum #52508

arbourd opened this issue Apr 22, 2022 · 4 comments
Assignees
Labels
GoCommand cmd/go modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@arbourd
Copy link

arbourd commented Apr 22, 2022

What version of Go are you using (go version)?

$ go version
go version go1.18.1 darwin/arm64

Does this issue reproduce with the latest release?

Yes, built from source on master and latest release.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE="auto"
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/dylan/Library/Caches/go-build"
GOENV="/Users/dylan/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/dylan/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/dylan/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/homebrew/Cellar/go/1.18.1/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/homebrew/Cellar/go/1.18.1/libexec/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.18.1"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/dylan/src/github.com/arbourd/test-go-broke/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/xz/1jqk4k092tv32h4b0v53wym00000gn/T/go-build1295850106=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Runing go get ./... on a specific go.sum and go.mod which I have provided here: https://github.com/arbourd/test-go-broke/tree/ac80f1816b6fa7b6ca7509c3e2fcf2f502003d19

What did you expect to see?

go get ./... to resolve packages or an error.

What did you see instead?

Command will hang indefinitely.

Some sleuthing

The infinite loop seems to have origins here: https://github.com/golang/go/blob/go1.18.1/src/cmd/go/internal/modget/get.go#L350-L353

I built my own go binary with some fmt.Println, and it seems that changed is always true.

// Upgrades variable will always return this first
// [{github.com/suborbital/sat [{github.com/suborbital/sat v0.1.2}] { } <nil>} {github.com/suborbital/subo [{github.com/suborbital/subo v0.4.2}] { } <nil>}]
// The second iteration will return
// []
// and the cycle will repeat infinitely
upgrades := r.findAndUpgradeImports(ctx, queries)
if changed := r.applyUpgrades(ctx, upgrades); changed {
	// This will always be true
	continue
}
@thepudds
Copy link
Contributor

CC @bcmills @matloob

@bcmills bcmills self-assigned this Apr 23, 2022
@bcmills bcmills added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. modules labels Apr 23, 2022
@bcmills bcmills added this to the Go1.19 milestone Apr 23, 2022
@bcmills bcmills added the GoCommand cmd/go label Apr 23, 2022
@arbourd
Copy link
Author

arbourd commented May 27, 2022

Unfortunately the test repo no longer reproduces the error as it just upgrades the offending packages.

@bcmills
Copy link
Contributor

bcmills commented May 27, 2022

Thanks for the update — that in and of itself is an interesting clue.

Sorry I didn't get to debugging this before it resolved, though. 😞

@bcmills bcmills modified the milestones: Go1.19, Backlog May 31, 2022
@bcmills
Copy link
Contributor

bcmills commented Jun 12, 2023

Given the extensive changes to go get in CL 471595, and the fact that the original reproducer no longer reproduces the issue, I'm going to close this issue as non-reproducible and unlikely to be diagnosed.

If you see a similar hang with a release built from HEAD (or using Go 1.21.0 or higher), please do file a new issue for it.

@bcmills bcmills closed this as completed Jun 12, 2023
@bcmills bcmills closed this as not planned Won't fix, can't repro, duplicate, stale Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants