gomods / athens

A Go module datastore and proxy
https://docs.gomods.io
MIT License
4.44k stars 502 forks source link

Very slow when go.mod contains a new go version (go1.23) than in athens image (go1.22) - not caching #2000

Open chlunde opened 1 week ago

chlunde commented 1 week ago

Describe the bug A clear and concise description of what the bug is.

Inside the athens container, the following command takes 40s when go.mod for github.com/org/repo uses go1.23:

wget http://localhost:3000/github.com/org/repo/@v/hash.info -O -

Downgrading go.mod to to go1.22.8 and updating the hash to that commit results in a 3 second response time.

There are probably three issues here:

To Reproduce

module github.com/org/repo

go 1.23.2

Expected behavior

Environment (please complete the following information):

ngshiheng commented 17 hours ago

Proxy version : 0.5.4 Storage (fs/mongodb/s3 etc.) : fs

just to clarify, do you mean v0.15.4 with disk StorageType?


Anyway, I am able to reproduce what you've encountered with go version 1.22.8 on Athens v0.15.4 using StorageType "memory" and "disk"), but not when i am using s3

have you had a chance to try this with other StorageTypes, like s3, mongo, minio, etc.? it would be super helpful if you could give that a shot too

To Reproduce

  1. module fetched: curl -v http://localhost:3000/github.com/planetscale/cli/@v/v0.214.0.info (which has go 1.23.2 directive in its go.mod)
  2. go version: go version go1.22.8 darwin/arm64
  3. config.dev.toml: StorageType = "disk" or memory

Logs

Expand to see logs on Athens server ❯ go version go version go1.22.8 darwin/arm64 ❯ make run cd ./cmd/proxy && go run . -config_file ../../config.dev.toml INFO[7:19PM]: Exporter not specified. Traces won't be exported INFO[7:19PM]: Starting application tcpPort=:3000 DEBUG[7:19PM]: saving github.com/planetscale/cli@v0.214.0 to storage... http-method=GET http-path=/github.com/planetscale/cli/@v/v0.214.0.info request-id=5c06cbda-044d-46fb-926d-5cd789f239e5 INFO[7:19PM]: github.com/planetscale/cli@v0.214.0 requires go >= 1.23.2 (running go 1.22.8; GOTOOLCHAIN=local) http-method=GET http-path=/github.com/planetscale/cli/@v/v0.214.0.info kind=Not Found module=github.com/planetscale/cli operation=download.InfoHandler ops=[download.InfoHandler pool.Info protocol.Info protocol.processDownload stash.Pool stasher.Stash stasher.fetchModule goGetFetcher.Fetch module.downloadModule] request-id=5c06cbda-044d-46fb-926d-5cd789f239e5 version=v0.214.0 INFO[7:19PM]: incoming request http-method=GET http-path=/github.com/planetscale/cli/@v/v0.214.0.info http-status=404 request-id=5c06cbda-044d-46fb-926d-5cd789f239e5

Response from curl: 404

Expand to see curl verbose response ❯ curl -v http://localhost:3000/github.com/planetscale/cli/@v/v0.214.0.info * Host localhost:3000 was resolved. * IPv6: ::1 * IPv4: 127.0.0.1 * Trying [::1]:3000... * Connected to localhost (::1) port 3000 > GET /github.com/planetscale/cli/@v/v0.214.0.info HTTP/1.1 > Host: localhost:3000 > User-Agent: curl/8.7.1 > Accept: */* > * Request completely sent off < HTTP/1.1 404 Not Found < Content-Type: application/json; charset=utf-8 < Date: Mon, 18 Nov 2024 11:21:54 GMT < Content-Length: 0 < * Connection #0 to host localhost left intact ~ ❯

i'm trying to narrow down if this only happens specifically for memory/disk storage type