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

Fix a cache corruption issue during revalidation #476

Merged
merged 1 commit into from Jan 31, 2024

Conversation

casperisfine
Copy link
Contributor

Fix: #474
Fix: #471

As noticed by Stan Hu, upon revalidation, we'd corrupt the data_size field, as it wasn't initialized at all on the cache key we computed from the source file.

The only thing we actually want to update is the mtime.

Co-Authored-By: @stanhu (we didn't pair, but spotting the root cause was 99% of the work, so...)

For now I leave the revalidation as optional, but will likely flip it back on in another release next week, once it has run for a while on our CI without issues.

Fix: #474
Fix: #471

As noticed by Stan Hu, upon revalidation, we'd corrupt the
`data_size` field, as it wasn't initialized at all on the
cache key we computed from the source file.

The only thing we actually want to update is the `mtime`.

Co-Authored-By: Stan Hu <stanhu@gmail.com>
@casperisfine casperisfine merged commit 08cd0d9 into main Jan 31, 2024
16 checks passed
@DanceMore
Copy link

heh, I managed to hit this. I did rails new like 5 days ago and got 1.18.1 as the resolved version when gem ran at the time. everything worked fine in development but this morning I'm trying to run the container in an integration environment and getting:

/usr/local/bundle/ruby/3.3.0/gems/bootsnap-1.18.1/lib/bootsnap/compile_cache/iseq.rb:64:in `fetch': Invalid argument - /rails/tmp/cache/bootsnap/compile-cache-iseq/43/3d67c7ba74db1a (Errno::EINVAL)
	from /usr/local/bundle/ruby/3.3.0/gems/bootsnap-1.18.1/lib/bootsnap/compile_cache/iseq.rb:64:in `fetch'
	from /usr/local/bundle/ruby/3.3.0/gems/bootsnap-1.18.1/lib/bootsnap/compile_cache/iseq.rb:89:in `load_iseq'
	from /usr/local/bundle/ruby/3.3.0/gems/bootsnap-1.18.1/lib/bootsnap/compile_cache.rb:33:in `require_relative'
	from /usr/local/bundle/ruby/3.3.0/gems/bootsnap-1.18.1/lib/bootsnap/compile_cache.rb:33:in `setup'
	from /usr/local/bundle/ruby/3.3.0/gems/bootsnap-1.18.1/lib/bootsnap.rb:67:in `setup'
	from /usr/local/bundle/ruby/3.3.0/gems/bootsnap-1.18.1/lib/bootsnap.rb:110:in `default_setup'
	from /usr/local/bundle/ruby/3.3.0/gems/bootsnap-1.18.1/lib/bootsnap/setup.rb:5:in `<top (required)>'
	from /usr/local/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
	from /usr/local/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /rails/config/boot.rb:4:in `<top (required)>'
	from ./bin/rails:3:in `require_relative'
	from ./bin/rails:3:in `<main>'

I'm using the new Dockerfile that comes with Rails7.1 instead of my own Dockerfile(s), so at first I was worried something was broken with my build entirely. found this bug, bumped to 1.18.3, issue resolved 🚀

@dlsteuer
Copy link

dlsteuer commented Feb 1, 2024

I had this error pop up yesterday and it's still happening to me even on 1.18.3, are there any workarounds?

@casperisfine
Copy link
Contributor Author

@dlsteuer have you cleared your cache? To be fair I should have bumped the cache version, my bad.

@casperisfine
Copy link
Contributor Author

Next release will. 811b34a

@dlsteuer
Copy link

dlsteuer commented Feb 1, 2024

@dlsteuer have you cleared your cache? To be fair I should have bumped the cache version, my bad.

Is this just a matter of deleting the cache folder?

@casperisfine
Copy link
Contributor Author

Is this just a matter of deleting the cache folder?

Yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants