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: retry failed fetches #28194

Open
chai2010 opened this issue Oct 14, 2018 · 16 comments
Open

cmd/go: retry failed fetches #28194

chai2010 opened this issue Oct 14, 2018 · 16 comments

Comments

@chai2010
Copy link
Contributor

@chai2010 chai2010 commented Oct 14, 2018

$ go version
go version go1.11.1 darwin/amd64
package main

import (
	_ "github.com/google/go-cloud/wire/cmd/wire"
)

func main() {
	//
}
go build -o a.out
go: finding github.com/google/go-cloud/wire/cmd/wire latest
go: finding github.com/google/go-cloud/wire/cmd latest
go: finding github.com/google/go-cloud/wire latest
go: finding google.golang.org/api v0.0.0-20180606215403-8e9de5a6de6d
go: google.golang.org/api@v0.0.0-20180606215403-8e9de5a6de6d: git fetch -f https://code.googlesource.com/google-api-go-client refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /Users/chai/go/pkg/mod/cache/vcs/9e62a95b0409d58bc0130bae299bdffbc7b7e74f3abe1ecf897474cc474b8bc0: exit status 128:
        error: RPC failed; curl 18 transfer closed with outstanding read data remaining
        fatal: The remote end hung up unexpectedly
        fatal: early EOF
        fatal: index-pack failed
go: error loading module requirements
@mvdan
Copy link
Member

@mvdan mvdan commented Oct 15, 2018

@chai2010 it looks like git had an issue fetching data from the remote repository. Have you tried running the same command again?

@bcmills perhaps we should try to capture network flakiness errors from HTTP/VCS and report a more user friendly error, such as "perhaps try again in a few minutes".

@mvdan mvdan changed the title module: build failed cmd/go: module build failed due to 'git fetch' error Oct 15, 2018
@chai2010
Copy link
Contributor Author

@chai2010 chai2010 commented Oct 17, 2018

$ HTTPS_PROXY=socks5://127.0.0.1:2080 go build -o a.out
go: finding github.com/google/go-cloud/wire/cmd/wire latest
go: finding github.com/google/go-cloud/wire/cmd latest
go: finding github.com/google/go-cloud/wire latest
go: finding google.golang.org/api v0.0.0-20180606215403-8e9de5a6de6d
go: google.golang.org/api@v0.0.0-20180606215403-8e9de5a6de6d: git fetch -f https://code.googlesource.com/google-api-go-client refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /Users/chai/go/pkg/mod/cache/vcs/9e62a95b0409d58bc0130bae299bdffbc7b7e74f3abe1ecf897474cc474b8bc0: exit status 128:
        error: RPC failed; curl 18 transfer closed with outstanding read data remaining
        fatal: The remote end hung up unexpectedly
        fatal: early EOF
        fatal: index-pack failed
go: error loading module requirements
@thepudds
Copy link

@thepudds thepudds commented Oct 21, 2018

@gopherbot, please add label modules

@mrxliu
Copy link

@mrxliu mrxliu commented Dec 19, 2018

感觉是并行下载外加网速不好导致的.

@mvdan
Copy link
Member

@mvdan mvdan commented Dec 19, 2018

Please write in English.

@agnivade
Copy link
Contributor

@agnivade agnivade commented Dec 19, 2018

In any case, this is indeed a network issue. I was able to reproduce this once out of 3 tries by just running the plain git command (git fetch -f https://code.googlesource.com/google-api-go-client ).

``` $git fetch -f https://code.googlesource.com/google-api-go-client remote: Sending approximately 87.36 MiB ... remote: Counting objects: 45, done remote: Finding sources: 100% (71244/71244) error: RPC failed; curl 56 GnuTLS recv error (-9): A TLS packet with unexpected length was received. fatal: The remote end hung up unexpectedly fatal: early EOF fatal: index-pack failed 14:13:31-agniva-~/play/gg$rm -rf .git/ 14:13:48-agniva-~/play/gg$git init Initialized empty Git repository in /home/agniva/play/gg/.git/ 14:13:53-agniva-~/play/gg$git fetch -f https://code.googlesource.com/google-api-go-client remote: Sending approximately 87.36 MiB ... remote: Counting objects: 45, done remote: Finding sources: 100% (71244/71244) remote: Total 71244 (delta 44173), reused 71141 (delta 44173) Receiving objects: 100% (71244/71244), 86.49 MiB | 999.00 KiB/s, done. Resolving deltas: 100% (44173/44173), done. From https://code.googlesource.com/google-api-go-client * branch HEAD -> FETCH_HEAD 14:15:46-agniva-~/play/gg$rm -rf .git/ 14:15:51-agniva-~/play/gg$git init Initialized empty Git repository in /home/agniva/play/gg/.git/ 14:15:52-agniva-~/play/gg$git fetch -f https://code.googlesource.com/google-api-go-client remote: Sending approximately 87.36 MiB ... remote: Counting objects: 45, done remote: Finding sources: 100% (71244/71244) remote: Total 71244 (delta 44173), reused 71141 (delta 44173) Receiving objects: 100% (71244/71244), 86.49 MiB | 1.10 MiB/s, done. Resolving deltas: 100% (44173/44173), done. From https://code.googlesource.com/google-api-go-client * branch HEAD -> FETCH_HEAD ```

@chai2010 - Could you run the git command manually as shown above and see if you get any error ? If yes, then it's a network issue. If not, then try to run go build once more and see if you get the same error.

@smallnest
Copy link

@smallnest smallnest commented Jan 17, 2019

I have the same issue:

workspace git clone https://code.googlesource.com/google-api-go-client
Cloning into 'google-api-go-client'...
remote: Sending approximately 139.63 MiB ...
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

I have modified the git buffer:

git config --global http.postBuffer 524288000
@bcmills bcmills changed the title cmd/go: module build failed due to 'git fetch' error cmd/go: retry failed fetches Jan 17, 2019
@bcmills bcmills added this to the Go1.13 milestone Jan 17, 2019
@bcmills bcmills self-assigned this Mar 4, 2019
@northfun
Copy link

@northfun northfun commented Mar 29, 2019

@mvdan Is there any solutions, such as copy the git repository directly to the mod directory?
I always get this problem,under $GOPATH I can download the zip file from git then do some other work to solve it, but with go mod I have no idea.
Thanks~

@bcmills
Copy link
Member

@bcmills bcmills commented Mar 29, 2019

@northfun, this issue is about retrying past temporary failures, not permanent ones.

If you are unable to download from some origin in general, you may need to set up a proxy for that module. (See https://tip.golang.org/cmd/go/#hdr-Module_proxy_protocol.)

@northfun
Copy link

@northfun northfun commented Apr 1, 2019

@bcmills ,thanks for your advice~
I solved it using GOPROXY in local file system finally, it cost me some time (- -|||)

@horacimacias
Copy link

@horacimacias horacimacias commented May 22, 2019

@northfun would you mind sharing a bit more information on what you did? I'm also hitting this same issue

@rsc
Copy link
Contributor

@rsc rsc commented Jun 6, 2019

It's unclear how to decide what is worth retrying and what is not, especially as it interacts with GOPROXY list fallback as well as executing VCS commands (the example above is git itself failing). Let's at least move this off to Go 1.14. It may be that there's nothing to do anyway, but certainly not for Go 1.13.

@engin
Copy link

@engin engin commented Sep 10, 2019

go: finding github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72
go: golang.org/x/tools@v0.0.0-20190729092621-ff9f1409240a: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /go/pkg/mod/cache/vcs/b44680b3c3708a854d4c89f55aedda0b223beb8d9e30fba969cefb5bd9c1e843: exit status 128:
	fatal: the remote end hung up unexpectedly
	fatal: early EOF
	fatal: index-pack failed
go: golang.org/x/tools@v0.0.0-20190311212946-11955173bddd: unknown revision 11955173bddd
go: golang.org/x/tools@v0.0.0-20180221164845-07fd8470d635: unknown revision 07fd8470d635
go: golang.org/x/tools@v0.0.0-20190114222345-bf090417da8b: unknown revision bf090417da8b
go: golang.org/x/text@v0.3.0: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /go/pkg/mod/cache/vcs/5b03666c2d7b526129bad48c5cea095aad8b83badc1daa202e7b0279e3a5d861: exit status 128:
	fatal: the remote end hung up unexpectedly
	fatal: early EOF
	fatal: index-pack failed
go: error loading module requirements

for me it was a kind of same problem; using GOPROXY=https://proxy.golang.org fixed it

@bcmills bcmills removed this from the Go1.14 milestone Oct 15, 2019
@bcmills bcmills added this to the Backlog milestone Oct 15, 2019
@rahmatrhd
Copy link

@rahmatrhd rahmatrhd commented Dec 30, 2019

Similar issue here, but solved using GOPROXY=https://proxy.golang.org as @engin suggested 👍

btw, this is my go mod download error log:

...
go: finding github.com/go-playground/locales v0.12.1
go: github.com/go-sql-driver/mysql@v1.4.1: unknown revision v1.4.1
go: github.com/cznic/fileutil@v0.0.0-20180108211300-6a051e75936f: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /go/pkg/mod/cache/vcs/bdb87437caea4326c185626ae164c5d8ab96681b040cbd9dd4b9a3552547e1e3: exit status 128:
	fatal: unable to access 'https://github.com/cznic/fileutil/': Failed to connect to github.com port 443: Connection timed out
go: github.com/onsi/gomega@v1.4.3: unknown revision v1.4.3
go: finding golang.org/x/tools v0.0.0-20190328211700-ab21143f2384
go: finding google.golang.org/api v0.3.2
...
@linzhp
Copy link
Contributor

@linzhp linzhp commented May 23, 2020

Would GOPROXY=https://proxy.internal.com,https://proxy.internal.com effectively retry failed fetches for a second time?

@jayconrod
Copy link
Contributor

@jayconrod jayconrod commented May 26, 2020

@linzhp No, but in Go 1.15, GOPROXY=https://proxy.internal.com|https://proxy.internal.com would do that (using a | separator instead of ,). #37367 has the details on that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet