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

undefined method `thread_mattr_accessor' when not requiring the Sprockets Railstie #85

Closed
richardboehme opened this issue Aug 21, 2020 · 3 comments · Fixed by #86
Closed
Labels
bug Something isn't working

Comments

@richardboehme
Copy link

Hey there!

I've stumbled upon an issue while installing this gem. When starting up the rails application, console or the mentionend installer I get the following error:

undefined method 'thread_mattr_accessor' for GoodJob::CurrentExecution:Module (NoMethodError)

I checked what caused the error and it seems like the gem is currently not working when one excludes the sprockets railstie in application.rb. The sprockets railstie requires action_view/helpers which then somehow requires the active support core extension that holds the required method. My best bet would be to simply require the core extension active_support/core_ext/module/attribute_accessors_per_thread in lib/good_job/current_execution.rb where the missing method is used.
While this issue is not fixed one can just require the mentioned core extension in application.rb.

Steps to reproduce

  • rails new good_job --skip-sprockets (make sure sprockets/railstie is not required in config/application.rb)
  • Add gem 'good_job' to your Gemfile
  • bundle install
  • rails g good_job:install

Backtrace

Traceback (most recent call last):
        49: from bin/rails:4:in `<main>'
        48: from /home/richard/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:324:in `require'
        47: from /home/richard/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:291:in `load_dependency'
        46: from /home/richard/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:324:in `block in require'
        45: from /home/richard/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
        44: from /home/richard/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
        43: from /home/richard/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        42: from /home/richard/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
        41: from /home/richard/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
        40: from /home/richard/.rvm/gems/ruby-2.7.1/gems/railties-6.0.3.2/lib/rails/commands.rb:18:in `<main>'
        39: from /home/richard/.rvm/gems/ruby-2.7.1/gems/railties-6.0.3.2/lib/rails/command.rb:46:in `invoke'
        38: from /home/richard/.rvm/gems/ruby-2.7.1/gems/railties-6.0.3.2/lib/rails/command/base.rb:69:in `perform'
        37: from /home/richard/.rvm/gems/ruby-2.7.1/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch'
        36: from /home/richard/.rvm/gems/ruby-2.7.1/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
        35: from /home/richard/.rvm/gems/ruby-2.7.1/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
        34: from /home/richard/.rvm/gems/ruby-2.7.1/gems/railties-6.0.3.2/lib/rails/commands/console/console_command.rb:101:in `perform'
        33: from /home/richard/.rvm/gems/ruby-2.7.1/gems/railties-6.0.3.2/lib/rails/command/actions.rb:14:in `require_application_and_environment!'
        32: from /home/richard/.rvm/gems/ruby-2.7.1/gems/railties-6.0.3.2/lib/rails/command/actions.rb:22:in `require_application!'
        31: from /home/richard/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:324:in `require'
        30: from /home/richard/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:291:in `load_dependency'
        29: from /home/richard/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:324:in `block in require'
        28: from /home/richard/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
        27: from /home/richard/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
        26: from /home/richard/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        25: from /home/richard/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
        24: from /home/richard/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
        23: from /home/richard/repos/oer/backend/config/application.rb:17:in `<main>'
        22: from /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/bundler.rb:174:in `require'
        21: from /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/bundler/runtime.rb:58:in `require'
        20: from /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/bundler/runtime.rb:58:in `each'
        19: from /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/bundler/runtime.rb:69:in `block in require'
        18: from /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/bundler/runtime.rb:69:in `each'
        17: from /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/bundler/runtime.rb:74:in `block (2 levels) in require'
        16: from /home/richard/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
        15: from /home/richard/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
        14: from /home/richard/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        13: from /home/richard/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
        12: from /home/richard/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
        11: from /home/richard/.rvm/gems/ruby-2.7.1/gems/good_job-1.2.0/lib/good_job.rb:13:in `<main>'
        10: from /home/richard/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:324:in `require'
         9: from /home/richard/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:291:in `load_dependency'
         8: from /home/richard/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:324:in `block in require'
         7: from /home/richard/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
         6: from /home/richard/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
         5: from /home/richard/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
         4: from /home/richard/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
         3: from /home/richard/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
         2: from /home/richard/.rvm/gems/ruby-2.7.1/gems/good_job-1.2.0/lib/good_job/current_execution.rb:1:in `<main>'
         1: from /home/richard/.rvm/gems/ruby-2.7.1/gems/good_job-1.2.0/lib/good_job/current_execution.rb:5:in `<module:GoodJob>'
/home/richard/.rvm/gems/ruby-2.7.1/gems/good_job-1.2.0/lib/good_job/current_execution.rb:10:in `<module:CurrentExecution>': undefined method `thread_mattr_accessor' for GoodJob::CurrentExecution:Module (NoMethodError)

System info

Ruby 2.7.1
Rails 6.0.3.2

@bensheldon
Copy link
Owner

@richardboehme thank you for the comprehensive bug report! I will reproduce and get this fixed.

I have to wonder what other implicit dependencies exist in GoodJob, but I want to get you unblocked asap.

@bensheldon
Copy link
Owner

@richardboehme I just released v1.2.1 on Rubygems with a fix for this. Thank you again for reporting this bug 🙌

@richardboehme
Copy link
Author

Wow that was super fast. Thank you very much. I've upgraded and everything works fine now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants