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

x/pkgsite/devtools/cmd/seeddb: -keep_going through version list errors #71140

Open
jeanbza opened this issue Jan 6, 2025 · 4 comments
Open
Assignees
Labels
BugReport Issues describing a possible bug in the Go implementation. pkgsite
Milestone

Comments

@jeanbza
Copy link
Contributor

jeanbza commented Jan 6, 2025

What is the URL of the page with the issue?

https://artifacts.netflix.net/api/go/goproxy (private jfrog artifactory go module proxy)

What is your user agent?

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36

Screenshot

No response

What did you do?

GO_MODULE_PROXY_URL=https://artifacts.netflix.net/api/go/goproxy go run devtools/cmd/seeddb/main.go -keep_going=true

What did you see happen?

Blows up at https://cs.opensource.google/go/x/pkgsite/+/master:devtools/cmd/seeddb/main.go;l=95

What did you expect to see?

keep_going should keep going when versions results in an error.


Explanation: jFrog Artifactory version listing for version-less repos

For repos with no tagged versions, jFrog Artifactory's go module proxy returns 404 for version list. ex https://github.netflix.net/example/foo has no releases, https://artifacts.netflix.net/api/go/goproxy/github.netflix.net/example/foo/@v/list returns {"errors":[{"status":404,"message":"Could not find resource"}]}.

This is in contrast to proxy.golang.org, which would return a blank 200. See https://github.com/jeanbza/sim-hashing which has no versions, https://proxy.golang.org/github.com/jeanbza/sim-hashing/@v/list returns 200:

$ curl https://proxy.golang.org/github.com/jeanbza/sim-hashing/@v/list -i
HTTP/2 200

This makes using seeddb a pain: you have to first prune your seed.txt of version-less repos before seeding. We could just amend -keep_going to keep going through version errors instead.

@jeanbza jeanbza added the pkgsite label Jan 6, 2025
@gopherbot gopherbot added this to the Unreleased milestone Jan 6, 2025
@jeanbza
Copy link
Contributor Author

jeanbza commented Jan 6, 2025

@gabyhelp
Copy link

gabyhelp commented Jan 6, 2025

Related Issues

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

@jba jba self-assigned this Jan 6, 2025
@seankhliao seankhliao changed the title x/pkgsite: seeddb -keep_going through version list errors x/pkgsite/devtools/cmd/seeddb: -keep_going through version list errors Jan 7, 2025
@gabyhelp gabyhelp added the BugReport Issues describing a possible bug in the Go implementation. label Jan 7, 2025
@dmitshur
Copy link
Contributor

dmitshur commented Jan 7, 2025

Note that the module proxy protocol specification (https://go.dev/ref/mod#goproxy-protocol) is clear about expected HTTP status codes:

Successful HTTP responses must have the status code 200 (OK). Redirects (3xx) are followed. Responses with status codes 4xx and 5xx are treated as errors. The error codes 404 (Not Found) and 410 (Gone) indicate that the requested module or version is not available on the proxy, but it may be found elsewhere.

Returning 404 is used to indicate a module doesn't exist. When a module exists but has an empty list of known versions (perhaps because they're all pseudo-versions), a successful response, quoting, "must have the status code 200 (OK)".

Separately from x/pkgsite, is it possible to address the bug in the module proxy protocol implementation you're using?

@jba
Copy link
Contributor

jba commented Jan 7, 2025

@dmitshur I agree that jFrog should change their status code. But I bet they won't, because too many of their customers depend on it.

Meanwhile, this change is to a program used only for pkgsite testing, so I think it is harmless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BugReport Issues describing a possible bug in the Go implementation. pkgsite
Projects
None yet
Development

No branches or pull requests

5 participants