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
Ignore load path caches generated by a different ruby version #387
Conversation
Should it warn if the load path cache can't be used due to different Having the cache per RUBY_REVISION might be nicer and more in line with the compile cache behavior, not sure how much work that is though 😅 In any case, |
I don't think that's particularly useful. Bootsnap regularly expect caches to be invalidated.
That's a good point. I'll use the same key than the compile cache. |
Hum, I just remembered that what I liked too in |
784ae45
to
c510a18
Compare
Done. @eregon if you want to give it another look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks for the fix.
Couple review questions:
|
If the cache is missing or the version doesn't match, we initialize it with the version key. This cache is never really mutated, it's kind of generated all at once.
Yes it's fine. we could add the bootsnap version in there, but so far the cache format hasn't changed. In theory you never need to purge the bootsnap cache, bootsnap takes care of doing it itself. |
Fix: #384 Until now it was assume that if the `$LOAD_PATH` was identical, then the content of the paths would be too. However from one minor ruby version to another, the layout of the stdlib can change. So if the newer version is installed in the same place than the previous one, it might cause the load path cache to be invalid. So we store `RUBY_DESCRIPTION` in the cache and make sure it matches before reusing the cache.
c510a18
to
8726b29
Compare
Fix: #384
Until now it was assume that if the
$LOAD_PATH
was identical, then the content of the paths would be too.However from one minor ruby version to another, the layout of the stdlib can change. So if the newer version is installed in the same place than the previous one, it might cause the load path cache to be invalid.
So we store
RUBY_DESCRIPTION
in the cache and make sure it matches before reusing the cache.cc @eregon @noahgibbs if you mind giving this a quick look.