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: unexpected EOF error in proxy fetch path lacks error context #52727

Closed
bcmills opened this issue May 5, 2022 · 8 comments
Closed

cmd/go: unexpected EOF error in proxy fetch path lacks error context #52727

bcmills opened this issue May 5, 2022 · 8 comments
Labels
GoCommand cmd/go modules NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@bcmills
Copy link
Member

bcmills commented May 5, 2022

            # get https://proxy.golang.org/golang.org/x/xerrors/@v/v0.0.0-20191011141410-1b5146add898.mod
            # get https://proxy.golang.org/golang.org/x/xerrors/@v/v0.0.0-20191011141410-1b5146add898.mod: 200 OK (0.003s)
            golang.org/x/tools/cmd/goimports imports
            	golang.org/x/sys/execabs: golang.org/x/sys@v0.0.0-20211019181941-9d821ace8654: unexpected EOF
            # get https://proxy.golang.org/golang.org/x/mod/@v/list
            # get https://proxy.golang.org/golang.org/x/xerrors/@v/list
            # get https://proxy.golang.org/golang.org/x/xerrors/@v/list: 200 OK (0.013s)

This may well be a bug in the proxy.golang.org server, but without more detail from the error message we don't have a good way to track it down. Step one is to improve the error message to describe exactly which URL produced the unexpected EOF error.

@bcmills bcmills added help wanted NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. GoCommand cmd/go modules labels May 5, 2022
@bcmills bcmills added this to the Backlog milestone May 5, 2022
@bcmills bcmills assigned bcmills and unassigned bcmills May 5, 2022
@bcmills
Copy link
Member Author

bcmills commented May 6, 2022

Looks like this bug is pretty old. The first occurrence I could find in the logs is from 2019. 😅

greplogs -l -e '.*: [a-zA-Z0-9]+\.[a-zA-Z0-9]+[^@]*@v\d+\.\d+\.\d+[^:]*: unexpected EOF'

2022-05-05T18:48:46-d299b94-025a9c3/linux-amd64-wsl
2022-05-04T15:38:23-c6688b5/linux-386-longtest
2022-04-23T05:38:56-84e58bf-9717e8f/linux-mips64le-mengzhuo
2022-03-25T01:24:44-1e5ae83-8ab42a9/plan9-amd64-0intro
2022-01-24T22:28:27-bbe1937-84eefdc/plan9-amd64-0intro
2021-12-20T22:06:07-6040366-7c94355/plan9-amd64-0intro
2021-12-09T12:49:13-491a49a-65633fe/linux-amd64-wsl
2021-10-05T19:16:08-2dc2755-3100dc1/linux-amd64-wsl
2021-10-04T16:44:53-cedda3a-7d57324/linux-amd64-wsl
2021-10-02T13:15:42-e81a3d9-7bf7bbc/linux-amd64-wsl
2021-10-01T16:17:08-e81a3d9-f19b2d5/linux-amd64-wsl
2021-09-14T13:53:08-0c0215e-b3c6de9/linux-amd64-wsl
2021-09-07T14:53:41-ad29c8a-21de6bc/linux-amd64-wsl
2021-08-20T15:37:55-19b2f83-ec51703/linux-amd64-wsl
2021-08-17T13:57:48-c8c9087-ec51703/linux-amd64-wsl
2021-08-17T02:49:38-e0c9fd4-91a935e/linux-amd64-wsl
2021-08-03T15:01:07-3395cb0-7921829/linux-amd64-wsl
2021-07-30T14:01:30-55fae94-b7a85e0/linux-amd64-wsl
2021-07-17T18:43:54-ea8c25a-aa4e0f5/plan9-amd64-0intro
2021-07-12T15:00:05-a46b181-3d1d066/linux-amd64-wsl
2021-06-21T14:58:02-06fdb77-7a5e704/linux-amd64-wsl
2021-06-10T13:23:58-84b48f8-7677616/linux-amd64-wsl
2021-06-09T14:15:26-9f230b5-aa5540c/linux-amd64-wsl
2021-06-03T11:23:40-99ded55-6b411e9/linux-amd64-wsl
2021-06-02T15:04:26-7271753-e3c9537/linux-amd64-wsl
2021-05-28T13:47:27-333eda0-c92adf4/linux-amd64-wsl
2021-05-27T15:33:46-a3eb095-fca7b8f/linux-amd64-wsl
2021-05-26T13:23:13-fea2f6f-3380b18/linux-amd64-wsl
2021-05-20T14:08:36-0886cdd-04cd717/linux-amd64-wsl
2021-05-19T13:04:45-4163338-658b5e6/linux-amd64-wsl
2021-05-12T16:42:30-9dfac01-04cd717/linux-amd64-wsl
2021-04-27T13:59:22-7b9993c-0b9ca4d/linux-amd64-wsl
2021-04-21T14:15:55-798c215-daee726/linux-amd64-wsl
2021-04-20T14:30:03-d25e304-3ff6ff7/linux-amd64-wsl
2021-03-30T03:28:19-769264c-3394586/linux-amd64-wsl
2021-03-29T05:50:11-0df2b77-ba6bd96/linux-amd64-wsl
2021-03-24T05:16:36-2c4c8ec-dcffdac/linux-amd64-wsl
2021-03-23T05:12:39-0d94d28-f4b9183/linux-amd64-wsl
2021-03-23T05:12:12-d523dce-cd26192/linux-amd64-wsl
2021-03-19T21:57:54-0d94d28-dcffdac/linux-amd64-wsl
2021-03-18T04:17:00-9b614f5-c2d6251/linux-amd64-wsl
2021-03-18T03:52:02-372c93a-42c25e6/linux-amd64-wsl
2021-03-15T23:47:56-34ac3e1-661f3f1/linux-amd64-wsl
2021-03-15T10:23:23-e18ecbb-6ccb5c4/linux-amd64-wsl
2021-03-11T17:08:05-5ea612d-3979fb9/linux-amd64-wsl
2021-03-09T02:20:55-5c1e898-618b66e/linux-amd64-wsl
2021-03-07T15:14:49-5c1e898-3068d55/linux-amd64-wsl
2021-03-05T23:58:34-a95e02b-414fa8c/linux-amd64-wsl
2021-03-02T06:08:56-65c8374-ebb92df/plan9-arm
2021-02-19T00:41:36-4410531-40765ff/linux-amd64-wsl
2020-03-01T02:13:41-0de0cce-33e9832/linux-ppc64-buildlet
2019-11-05T01:01:31-0deb692-376c4ce/freebsd-386-11_2
2019-09-11T03:32:35-c13cbed-904f046/windows-386-2008

@bcmills
Copy link
Member Author

bcmills commented May 16, 2022

I think this is coming from the net/http package: a mismatched Content-Length header on the HTTP response seems to provoke an unexpected EOF error without additional detail (https://go.dev/play/p/nJN-O8xOT1W).

That appears to come from here:
https://cs.opensource.google/go/go/+/master:src/net/http/transfer.go;l=862-866;drc=0537a74b76fcab1398da6699c3ff7411fef8fbe7

The error text is not in line with Effective Go's guidance ”to provide detailed error information”, but it almost certainly cannot be changed now, so we need to wrap the error on the caller side.

@bcmills bcmills self-assigned this May 16, 2022
@bcmills bcmills modified the milestones: Backlog, Go1.19 May 16, 2022
@bcmills bcmills added NeedsFix The path to resolution is known, but the work has not been done. and removed help wanted labels May 16, 2022
@gopherbot gopherbot removed the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label May 16, 2022
@gopherbot
Copy link

Change https://go.dev/cl/406675 mentions this issue: cmd/go/internal/modfetch: wrap errors from HTTP response bodies

@bcmills
Copy link
Member Author

bcmills commented Jul 20, 2022

They are indeed, although they have context now.

(The read "https:/goproxy.io/@v/v0.0.0-20220209214540-3681064d5158.zip" part is new, and suggests that perhaps we should retry — and/or use range requests for — zip files.)

@gopherbot
Copy link

Change https://go.dev/cl/461682 mentions this issue: cmd/go/internal/modfetch: avoid path.Join in URL errors

gopherbot pushed a commit that referenced this issue Jan 27, 2023
path.Join collapses duplicated '/' tokens, but an HTTP URL
intentionally includes a '://' after the scheme.

This should fix the syntax of the errors seen in
https://build.golang.org/log/a17d0c7b6159ea4dad0a9e5378ab5a36ee30ce44.

Updates #52727.

Change-Id: I6e1773a7eb8b3e7e2b3ca29540c1e94a7cd2d99d
Reviewed-on: https://go-review.googlesource.com/c/go/+/461682
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
@gopherbot
Copy link

Change https://go.dev/cl/532015 mentions this issue: cmd/go/internal/modfetch: avoid path.Join in URL errors, part 2

@gopherbot
Copy link

Change https://go.dev/cl/532035 mentions this issue: cmd/go/internal/modfetch: show real URL in error

gopherbot pushed a commit that referenced this issue Nov 2, 2023
CL 406675 added more detail to bare errors from net/http in two places.
CL 461682 improved one of the two places to stop folding "//" into "/".
This CL applies the same change to the other place.

For #52727.

Change-Id: I3fc13f30cf0f054949ce78269c52b7fafd477e70
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/532015
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
gopherbot pushed a commit that referenced this issue Nov 3, 2023
CL 233437 added a redactedURL field to proxyRepo, a struct that already
had a field named 'url'. Neither fields were documented, so the similar
names suggest the most natural interpretation that proxyRepo.redactedURL
is equivalent to proxyRepo.url.Redacted() rather than something else.
That's possibly why it was joined with the module version in CL 406675.

It turns out the two URLs differ in more than just redaction: one is the
base proxy URL with (escaped) module path joined, the other is just the
base proxy URL, in redacted form.

Document and rename the fields to make the distinction more clear, and
include all 3 of base module proxy URL + module path + module version
in the reported URL, rather than just the first and third bits as seen
in the errors at https://go.dev/issue/51323#issuecomment-1735812250.

For #51323.
Updates #38680.
Updates #52727.

Change-Id: Ib4b134b548adeec826ee88fe51a2cf580fde0516
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/532035
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go modules NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants