Closed jhawthorn closed 1 year ago
Thanks for the detailed report. The purge should happen nearly instantly (it’s async but not actually delayed). I have a hunch it’s related to the domain. Can you try again and see if you see it right away on https://api.rubygem.org/versions
?
Yeah, I ran into this previously: #1698
The cache-busting code notifies fastly about index.rubygems.org
(which per comment in the above, Bundler uses for historical reasons), but not plain rubygems.org
(which is, AIUI, the per-spec place a client should look if that's the URL it was originally told).
If it's possible, it does seem likely to prevent future confusion if the server could invalidate both (all?) hostnames.
Yeah, we should refactor that code to purge a list of domains (list is different for staging and production).
Oh look I started fixing this a long time ago: https://github.com/rubygems/rubygems.org/compare/fastly_multiple_domains
Oh look I started fixing this a long time ago
Awesome!
I had a chance to do some testing and the index ended up outdated on all three domains.
However index.rubygems.org
, the one we expect to be purged, is out of date in a particular way. Every time a package is pushed the previous package appears at https://index.rubygems.org/versions
, but not the one which was just pushed. I saw this happen three times in a row (with both my and others gems).
It feels like the purge is happening before the data is in the database. Is it possible the job gets queued and run while a DB transaction is still open and therefore the data is missed on the purge?
Is it possible the job gets queued and run while a DB transaction is still open?
Yes.
The other thing might be nginx cache. I think it’s caching for 60 seconds.
This seems like it might be the same issue I'm running into (details in https://github.com/rubygems/rubygems/issues/2594). I recently published a new version of a gem and gem search
and gem outdated
didn't have the new version for over 17 hours.
We should be purging all the right places now, are you still seeing this?
Interestingly, this looks better, but index.rubygems.org
still isn't able to pick up the most recent package. It's getting its cache purged, but the update only includes previous packages, not the current push.
$ for url in https://rubygems.org/versions https://index.rubygems.org/versions https://api.rubygems.org/versions ; do echo "$url"; curl -s "$url" | tail -3; echo; done
https://rubygems.org/versions
mangdown 0.20.4 72aa507ad95ee746610353ab2157b285
mangdown 0.20.5 bc65056cada0feb12e22473eb64ac33e
mangdown 0.20.6 e8df512dfaa8312f96642ddd7ccdc7b5
https://index.rubygems.org/versions
roebe -0.3.329 557995f5545d3ab8bb60ae1330edfc62
mangdown 0.20.4 72aa507ad95ee746610353ab2157b285
mangdown 0.20.5 bc65056cada0feb12e22473eb64ac33e
https://api.rubygems.org/versions
mangdown 0.20.4 72aa507ad95ee746610353ab2157b285
mangdown 0.20.5 bc65056cada0feb12e22473eb64ac33e
mangdown 0.20.6 e8df512dfaa8312f96642ddd7ccdc7b5
$ gem push pkg/hawthtest-0.1.2.gem
Pushing gem to https://rubygems.org...
You have enabled multi-factor authentication. Please enter OTP code.
Code: <REDACTED>
Successfully registered gem: hawthtest (0.1.2)
$ for url in https://rubygems.org/versions https://index.rubygems.org/versions https://api.rubygems.org/versions ; do echo "$url"; curl -s "$url" | tail -3; echo; done
https://rubygems.org/versions
mangdown 0.20.5 bc65056cada0feb12e22473eb64ac33e
mangdown 0.20.6 e8df512dfaa8312f96642ddd7ccdc7b5
hawthtest 0.1.2 df45a60b8e7be1fa7f69325ca51b6ac6
https://index.rubygems.org/versions
mangdown 0.20.4 72aa507ad95ee746610353ab2157b285
mangdown 0.20.5 bc65056cada0feb12e22473eb64ac33e
mangdown 0.20.6 e8df512dfaa8312f96642ddd7ccdc7b5
https://api.rubygems.org/versions
mangdown 0.20.5 bc65056cada0feb12e22473eb64ac33e
mangdown 0.20.6 e8df512dfaa8312f96642ddd7ccdc7b5
hawthtest 0.1.2 df45a60b8e7be1fa7f69325ca51b6ac6
Ok the problem must be the nginx cache then. I’ll need to look at this more to figure out a solution.
Seems like we are not effectively caching this endpoint in Fastly, which is why we need the nginx cache. (I tried removing the nginx cache and that was bad.) I'll continue to work on fixing the cache settings.
Hi, sorry about the delay in getting this resolved. We have deployed a few changes to make this situation better (see linked PRs above). Changes should now be reflected on versions endpoint in under a minute. Please let us know if you continue to see long delays (previously up to an hour). The reason for the delay (even of one minute) remains the same, the necessity of cache on nginx for this endpoint. I have suggested an optimization of our postgres config and I am waiting to hear back from the team on it. We will try removing nginx cache (again) after the config change is deployed.
cc: @mensfeld this is related to your report of bundler say gem not found.
@sonalkr132 thank you :pray: I will keep you posted about any potential issues.
This should be fixed, feel free to reopen on problems.
I've noticed a very long delay the last few times I've published a gem.
I pushed a gem 45 minutes ago
but it still isn't showing up in the
/versions
compact index.The last gem listed is over an hour old. It's missing (based on https://twitter.com/rubygems) 4 gems published since then.
However the info file looks good (but maybe the cache just wasn't warm here?)
Is fastly caching this too aggressively? It looks like there's code to bust this cache?
It seems like it updated finally right after the hour. Maybe this happens in a cron job? or maybe that's when the cache expires?