-
Notifications
You must be signed in to change notification settings - Fork 180
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
Exception raised when upgraded to ruby 3.3.1 and deployed to Heroku #484
Comments
This is a Ruby 3.3.1 bug, see: https://bugs.ruby-lang.org/issues/20450 To work around it you can add |
@byroot Unfortunately adding mutex_m to the gemfile did not resolve this for me. Do you have some additional context or advice that could help work around this? |
For anyone else who needs this, here's what I did to fix (credit to eugeneius) ruby/ruby#10619 (comment): create # frozen_string_literal: true
# typed: ignore
# rubocop:disable all
# :nocov:
# Context: Bootsnap doesn't work with Ruby 3.3.1
# https://github.com/Shopify/bootsnap/issues/484
# https://github.com/ruby/ruby/pull/10619
# https://bugs.ruby-lang.org/issues/20450
# https://github.com/ruby/ruby/pull/10619#issuecomment-2075896240
mod = Gem.send(:remove_const, :BUNDLED_GEMS).dup
Gem::BUNDLED_GEMS = mod
def mod.warning?(name, specs: nil)
# name can be a feature name or a file path with String or Pathname
feature = File.path(name)
# bootsnap expands `require "csv"` to `require "#{LIBDIR}/csv.rb"`,
# and `require "syslog"` to `require "#{ARCHDIR}/syslog.so"`.
name = feature.delete_prefix(Gem::BUNDLED_GEMS::ARCHDIR)
name.delete_prefix!(Gem::BUNDLED_GEMS::LIBDIR)
name.tr!("/", "-")
name.sub!(Gem::BUNDLED_GEMS::LIBEXT, "")
return if specs.include?(name)
_t, path = $:.resolve_feature_path(feature)
if gem = find_gem(path)
return if specs.include?(gem)
caller = caller_locations(3, 3)&.find {|c| c&.absolute_path}
return if find_gem(caller&.absolute_path)
elsif Gem::BUNDLED_GEMS::SINCE[name]
gem = true
else
return
end
return if Gem::BUNDLED_GEMS::WARNED[name]
Gem::BUNDLED_GEMS::WARNED[name] = true
if gem == true
gem = name
"#{feature} was loaded from the standard library, but"
elsif gem
return if Gem::BUNDLED_GEMS::WARNED[gem]
Gem::BUNDLED_GEMS::WARNED[gem] = true
"#{feature} is found in #{gem}, which"
else
return
end + build_message(gem)
end At the start of application.rb: |
After reformating your issue, it now seems clear
So you not only need |
Actually that was done a while ago already, just not released yet: rails/rails#50546 |
This issue is fixed with version 7.0.8.3 of Rails. |
I made sure the issue is in bootsnap
When I commented bootstrap out of the Gemfile and commented out require "bootsnap/setup" from
boot.rb
then was able to deploy successfully.Steps to reproduce
Upgrade to ruby 3.3.1 and
bundle install
, and commitGemfile
andGemfile.lock
Then
git push production master
Expected behavior
It should deploy to production.
Actual behavior
Saw following exception
System configuration
Bootsnap version:
1.18.3
Ruby version:
3.3.1
Rails version:
7.0.8.a
The text was updated successfully, but these errors were encountered: