bootsnap: iseq.rb:13 `to_binary`: wrong argument type false (expected Symbol)

Having issues with bootsnap on a rails new --main application using ruby-dev 3.1.0:

ruby -v
ruby 3.1.0dev (2021-11-01T08:48:03Z master b474049c78) [x86_64-darwin20]

./bootsnap-e1882c5993c3/lib/bootsnap/compile_cache/iseq.rb:13:in `to_binary': wrong argument type false (expected Symbol) (TypeError)
  from ./bootsnap-e1882c5993c3/lib/bootsnap/compile_cache/iseq.rb:13:in `input_to_storage'
  from ./bootsnap-e1882c5993c3/lib/bootsnap/compile_cache/iseq.rb:30:in `fetch'
  from ./bootsnap-e1882c5993c3/lib/bootsnap/compile_cache/iseq.rb:30:in `fetch'
  from ./bootsnap-e1882c5993c3/lib/bootsnap/compile_cache/iseq.rb:55:in `load_iseq'
  from ./bootsnap-e1882c5993c3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
  from ./bootsnap-e1882c5993c3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
  from ./bootsnap-e1882c5993c3/lib/bootsnap/load_path_cache/loaded_features_index.rb:100:in `register'
  from ./bootsnap-e1882c5993c3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
  from ./bootsnap-e1882c5993c3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
  from ./bootsnap-e1882c5993c3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `require_relative'

# gemfile.rb
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby "3.1.0"

# Use main development branch of Rails
gem "rails", github: "rails/rails", branch: "main"

# The traditional bundling and transpiling asset pipeline for Rails.
gem "sprockets-rails", ">= 2.0.0"

# Use postgresql as the database for Active Record
gem "pg", "~> 1.1"

# Use the Puma web server [https://github.com/puma/puma]
gem "puma", "~> 5.0"

# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
gem "importmap-rails", ">= 0.3.4"

# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
gem "turbo-rails", ">= 0.7.11"

# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
gem "stimulus-rails", ">= 0.4.0"

# Build JSON APIs with ease [https://github.com/rails/jbuilder]
gem "jbuilder", "~> 2.7"

# Use Redis adapter to run Action Cable in production
# gem "redis", "~> 4.0"

# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
# gem "kredis"

# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
# gem "bcrypt", "~> 3.1.7"

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]

# Reduces boot times through caching; required in config/boot.rb
gem "bootsnap", ">= 1.4.4", require: false, github: "Shopify/bootsnap"

# Use Sass to process CSS
# gem "sassc-rails", "~> 2.1"

# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
# gem "image_processing", "~> 1.2"

group :development, :test do
  # Start debugger with binding.b [https://github.com/ruby/debug]
  gem "debug", ">= 1.0.0", platforms: %i[ mri mingw x64_mingw ]
end

group :development do
  # Use console on exceptions pages [https://github.com/rails/web-console]
  gem "web-console", ">= 4.1.0"

  # Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
  # gem "rack-mini-profiler", ">= 2.3.3"

  # Speed up commands on slow machines / big apps [https://github.com/rails/spring]
  # gem "spring"
end

group :test do
  # Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
  gem "capybara", ">= 3.26"
  gem "selenium-webdriver", ">= 4.0.0"
  gem "webdrivers"
end

The same thing happened before trying the github: "Shopify/bootsnap", just wondering if this is a known issue or I’m missing something 🤔

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 3
  • Comments: 16 (9 by maintainers)

Commits related to this issue

Most upvoted comments

It looks like this bug made it into the released ruby 3.0.3:

$ ruby --version
ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [x86_64-darwin21]
$HOME/.rvm/gems/ruby-3.0.3/gems/bootsnap-1.9.1/lib/bootsnap/compile_cache/iseq.rb:13:in `to_binary': wrong argument type false (expected Symbol) (TypeError)
	from $HOME/.rvm/gems/ruby-3.0.3/gems/bootsnap-1.9.1/lib/bootsnap/compile_cache/iseq.rb:13:in `input_to_storage'
	from $HOME/.rvm/gems/ruby-3.0.3/gems/bootsnap-1.9.1/lib/bootsnap/compile_cache/iseq.rb:30:in `fetch'
...

Updating to 1.9.3 helped us with this issue. Thanks!

😭

Ok, I’ll have to ship a workaround. Thank you for letting me know.

The potential less impacting workaround: https://github.com/Shopify/bootsnap/pull/380, I’m just worried it might cause even worse problem, so I’d like to carefully test it first.

Any suggestions?

Your backtrace shows that you are running bootsnap 1.7.5 and Ruby 3.0.3. You should either upgrade to Ruby 3.0.4 or bootsnap 1.9.2 (or both really).

I pushed a 1.9.2 release that entirely disable ISeq compilation if that bug is detected.

I’ll see if I can do some more finely grained workaround.

We can keep it open as long as the Ruby bug isn’t fixed, so that other people looking for it can find it more easily.

To be clear, we found way more issues and it’s no longer a two lines change. Make sure to use the full branch: https://github.com/ruby/ruby/pull/5035