Closed wangmir closed 1 year ago
I'm not able to reproduce a hang on linux/amd64 with default GOPROXY
, nor with GOPROXY=direct
:
/tmp$ git clone https://github.com/ariga/atlas.git
Cloning into 'atlas'...
remote: Enumerating objects: 16391, done.
remote: Counting objects: 100% (1838/1838), done.
remote: Compressing objects: 100% (325/325), done.
remote: Total 16391 (delta 1596), reused 1596 (delta 1504), pack-reused 14553
Receiving objects: 100% (16391/16391), 7.54 MiB | 31.89 MiB/s, done.
Resolving deltas: 100% (10465/10465), done.
/tmp$ cd atlas
/tmp/atlas$ git checkout 32477e01988f8004265c44e9d4c9cdeb58ad42d3
Note: switching to '32477e01988f8004265c44e9d4c9cdeb58ad42d3'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
HEAD is now at 32477e01 sql/migrate: remove Validate hack (#1465)
/tmp/atlas$ go1.20.4 list -m all
ariga.io/atlas
github.com/DATA-DOG/go-sqlmock v1.5.0
github.com/agext/levenshtein v1.2.1
github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3
github.com/apparentlymart/go-textseg v1.0.0
github.com/apparentlymart/go-textseg/v13 v13.0.0
github.com/creack/pty v1.1.9
github.com/davecgh/go-spew v1.1.1
github.com/go-openapi/inflect v0.19.0
github.com/go-test/deep v1.0.3
github.com/golang/protobuf v1.3.4
github.com/google/go-cmp v0.5.6
github.com/hashicorp/hcl/v2 v2.10.0
github.com/kr/pretty v0.1.0
github.com/kr/pty v1.1.1
github.com/kr/text v0.2.0
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7
github.com/pmezard/go-difflib v1.0.0
github.com/sergi/go-diff v1.0.0
github.com/spf13/pflag v1.0.2
github.com/stretchr/objx v0.1.0
github.com/stretchr/testify v1.7.1-0.20210427113832-6241f9ab9942
github.com/vmihailenco/msgpack v3.3.3+incompatible
github.com/vmihailenco/msgpack/v4 v4.3.12
github.com/vmihailenco/tagparser v0.1.1
github.com/zclconf/go-cty v1.8.0
github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b
golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734
golang.org/x/mod v0.8.0
golang.org/x/net v0.0.0-20200301022130-244492dfa37a
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f
golang.org/x/sys v0.5.0
golang.org/x/text v0.8.0
golang.org/x/tools v0.6.0
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
google.golang.org/appengine v1.6.5
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
/tmp/atlas$ go clean -modcache
/tmp/atlas$ export GOPROXY=direct
/tmp/atlas$ go1.20.4 list -m all
git
due to GOPROXY=direct
?SIGQUIT
to the go
command while it appears to be stuck, and please attach the goroutine dump that it produces.Ah, now I see that you are experiencing the problem in the cmd/atlas
subdirectory.
Changing to that directory and setting GOPROXY=direct
, and then using watch pgrep -a git
, I see a lot of git
activity fetching various large dependencies (notably google-api-go-client
).
I also see that it is using a lot of older dependencies, with go.mod
files declaring go
versions that predate module graph pruning, which can cause a lot of extra git
traffic to extract go.mod
files for otherwise-irrelevant versions.
I suggest switching to the default GOPROXY
(https://proxy.golang.org
) and/or upgrading your dependencies to more recent releases to allow graph pruning to take effect. Perhaps also consider contributing upstream changes to enable graph pruning in the other modules you depend on; even after running go get -u ./... && go mod tidy
in that module, I see an awful lot of go.sum
entries for otherwise-irrelevant go.mod
files.
As far as I can tell this is an unfortunate situation where the dependency graph has become extremely large and direct fetching takes an inordinately long time.
The former problem is mitigated by graph pruning, which still needs to be enabled in certain large projects.
The latter problem is mitigated by the default GOPROXY
.
Beyond that, I don't think there is much we can do.
For reference, here is the list of dependencies of that module that do not yet have graph pruning enabled:
go list -f '{{with .Module}}{{if lt .GoVersion "1.17"}}{{.Path}} {{.Version}}: go {{.GoVersion}}{{end}}{{end}}' all | sort -u
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Initially, it happens on our private project, but I realized that, it can be reproducable on one of the public module I'm using.
From this repo (at
cmd/atlas
directory),https://github.com/ariga/atlas/tree/master/cmd/atlas
when I put
go list -m all
,it hangs forever.
What did you expect to see?
list of modules.
What did you see instead?
nothing. stuck forever.