Defect #30209

undefined method `alias_method_chain' for ActionView::Base:Class (NoMethodError)

Added by Tobias Verbeke 8 months ago. Updated about 1 month ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Plugin Request
Target version:-
Resolution:Invalid Affected version:4.0.0

Description

After upgrading from 3.4.6 to 4.0.0, redmine refused to launch.

The culprit was render_parent 0.0.8 using alias_method_chain which is not supported in rails5.

$ rails --version
Rails 5.2.2

I edited

/var/lib/gems/2.5.0/gems/render_parent-0.0.8/lib/render_parent/rails3/on_load_action_view.rb

and uncommented all lines with alias_method_chain assuming after which redmine came up.

Relevant nginx log:

App 11959 output: Error: The application encountered the following error: undefined method `alias_method_chain' for ActionView::Base:Class (NoMethodError)
App 11959 output:     /var/lib/gems/2.5.0/gems/render_parent-0.0.8/lib/render_parent/rails3/on_load_action_view.rb:25:in `block in <top (required)>'
App 11959 output:     /var/lib/gems/2.5.0/gems/render_parent-0.0.8/lib/render_parent/rails3/on_load_action_view.rb:1:in `class_eval'
App 11959 output:     /var/lib/gems/2.5.0/gems/render_parent-0.0.8/lib/render_parent/rails3/on_load_action_view.rb:1:in `<top (required)>'
App 11959 output:     /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `require'
App 11959 output:     /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `block in require'
App 11959 output:     /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in `load_dependency'
App 11959 output:     /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `require'
App 11959 output:     /var/lib/gems/2.5.0/gems/render_parent-0.0.8/lib/render_parent/rails3.rb:13:in `block (2 levels) in <class:Railtie>'
App 11959 output:     /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:71:in `instance_eval'
App 11959 output:     /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook'
App 11959 output:     /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control'
App 11959 output:     /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:67:in `execute_hook'
App 11959 output:     /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
App 11959 output:     /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:51:in `each'
App 11959 output:     /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
App 11959 output:     /var/lib/gems/2.5.0/gems/actionview-5.2.2/lib/action_view/base.rb:213:in `<class:Base>'
App 11959 output:     /var/lib/gems/2.5.0/gems/actionview-5.2.2/lib/action_view/base.rb:141:in `<module:ActionView>'
App 11959 output:     /var/lib/gems/2.5.0/gems/actionview-5.2.2/lib/action_view/base.rb:12:in `<top (required)>'
App 11959 output:     /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `require'
App 11959 output:     /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `block in require'
App 11959 output:     /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in `load_dependency'
App 11959 output:     /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `require'
App 11959 output:     /opt/redmine/redmine-4.0.0/lib/plugins/gravatar/init.rb:2:in `block in <top (required)>'
App 11959 output:     /opt/redmine/redmine-4.0.0/config/initializers/00-core_plugins.rb:12:in `eval'
App 11959 output:     /opt/redmine/redmine-4.0.0/config/initializers/00-core_plugins.rb:12:in `block in <top (required)>'
App 11959 output:     /opt/redmine/redmine-4.0.0/config/initializers/00-core_plugins.rb:2:in `each'
App 11959 output:     /opt/redmine/redmine-4.0.0/config/initializers/00-core_plugins.rb:2:in `<top (required)>'
App 11959 output:     /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:285:in `load'
App 11959 output:     /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:285:in `block in load'
App 11959 output:     /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in `load_dependency'
App 11959 output:     /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:285:in `load'
App 11959 output:     /var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/engine.rb:657:in `block in load_config_initializer'
App 11959 output:     /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/notifications.rb:170:in `instrument'
App 11959 output:     /var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/engine.rb:656:in `load_config_initializer'
App 11959 output:     /var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/engine.rb:614:in `block (2 levels) in <class:Engine>'
App 11959 output:     /var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/engine.rb:613:in `each'
App 11959 output:     /var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/engine.rb:613:in `block in <class:Engine>'
App 11959 output:     /var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/initializable.rb:32:in `instance_exec'
App 11959 output:     /var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/initializable.rb:32:in `run'
App 11959 output:     /var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/initializable.rb:61:in `block in run_initializers'
App 11959 output:     /usr/lib/ruby/2.5.0/tsort.rb:228:in `block in tsort_each'
App 11959 output:     /usr/lib/ruby/2.5.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
App 11959 output:     /usr/lib/ruby/2.5.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
App 11959 output:     /usr/lib/ruby/2.5.0/tsort.rb:431:in `each_strongly_connected_component_from'
App 11959 output:     /usr/lib/ruby/2.5.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
App 11959 output:     /var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/initializable.rb:50:in `each'
App 11959 output:     /var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/initializable.rb:50:in `tsort_each_child'
App 11959 output:     /usr/lib/ruby/2.5.0/tsort.rb:415:in `call'
App 11959 output:     /usr/lib/ruby/2.5.0/tsort.rb:415:in `each_strongly_connected_component_from'
App 11959 output:     /usr/lib/ruby/2.5.0/tsort.rb:349:in `block in each_strongly_connected_component'
App 11959 output:     /usr/lib/ruby/2.5.0/tsort.rb:347:in `each'
App 11959 output:     /usr/lib/ruby/2.5.0/tsort.rb:347:in `call'
App 11959 output:     /usr/lib/ruby/2.5.0/tsort.rb:347:in `each_strongly_connected_component'
App 11959 output:     /usr/lib/ruby/2.5.0/tsort.rb:226:in `tsort_each'
App 11959 output:     /usr/lib/ruby/2.5.0/tsort.rb:205:in `tsort_each'
App 11959 output:     /var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/initializable.rb:60:in `run_initializers'
App 11959 output:     /var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/application.rb:361:in `initialize!'
App 11959 output:     /opt/redmine/redmine-4.0.0/config/environment.rb:14:in `<top (required)>'
App 11959 output:     config.ru:3:in `require'
App 11959 output:     config.ru:3:in `block in <main>'
App 11959 output:     /var/lib/gems/2.5.0/gems/rack-2.0.6/lib/rack/builder.rb:55:in `instance_eval'
App 11959 output:     /var/lib/gems/2.5.0/gems/rack-2.0.6/lib/rack/builder.rb:55:in `initialize'
App 11959 output:     config.ru:1:in `new'
App 11959 output:     config.ru:1:in `<main>'
App 11959 output:     /usr/share/passenger/helper-scripts/rack-preloader.rb:101:in `eval'
App 11959 output:     /usr/share/passenger/helper-scripts/rack-preloader.rb:101:in `preload_app'
App 11959 output:     /usr/share/passenger/helper-scripts/rack-preloader.rb:189:in `block in <module:App>'
App 11959 output:     /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:380:in `run_block_and_record_step_progress'
App 11959 output:     /usr/share/passenger/helper-scripts/rack-preloader.rb:188:in `<module:App>'
App 11959 output:     /usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
App 11959 output:     /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<main>'
[ E 2018-12-13 23:13:49.2585 24277/T1k age/Cor/App/Implementation.cpp:221 ]: Could not spawn process for application /opt/redmine/redmine-current: The application encountered the following error: undefined method `alias_method_chain' for ActionView::Base:Class (NoMethodError)
  Error ID: ec7aa791
  Error details saved to: /tmp/passenger-error-CePNfb.html

[ E 2018-12-13 23:13:49.2671 24277/T9 age/Cor/Con/CheckoutSession.cpp:276 ]: [Client 1-6] Cannot checkout session because a spawning error occurred. The identifier of the error is ec7aa791. Please see earlier logs for details about the error.

About info:

Redmine LaTeX MathJax Macro
Creating scope :system. Overwriting existing method Enumeration.system.
Creating scope :sorted. Overwriting existing method Group.sorted.
Creating scope :sorted. Overwriting existing method User.sorted.

sh: 1: svn: not found
sh: 1: cvs: not found
sh: 1: bzr: not found
Environment:
  Redmine version                4.0.0.stable
  Ruby version                   2.5.3-p105 (2018-10-18) [x86_64-linux-gnu]
  Rails version                  5.2.2
  Environment                    production
  Database adapter               Mysql2
  Mailer queue                   ActiveJob::QueueAdapters::AsyncAdapter
  Mailer delivery                smtp
SCM:
  Mercurial                      2.8.2
  Git                            2.7.4
  Filesystem                     
Redmine plugins:
  redmine_latex_mathjax          0.3.0

History

#1 Updated by Nigel Wilson 8 months ago

I ran into this issue as well. I made the following changes in the GemFile to meet all the dependencies. However, I am using MS Sql Server, so you will need to find the corresponding adapter for mysql.

Change: gem "rails", "5.2.2"
To: gem "rails", :git => "https://github.com/rails/rails.git", :branch => "5-2-2"

Change: gem "tiny_tds", "~> 1.0.5"
To: "tiny_tds", "~> 2.1.2"

Change: gem "activerecord-sqlserver-adapter",
To: gem "activerecord-sqlserver-adapter", :git => "https://github.com/rails-sqlserver/activerecord-sqlserver-adapter.git",

#2 Updated by Jean-Philippe Lang 8 months ago

  • Category set to Plugin Request
  • Status changed from New to Closed
  • Resolution set to Invalid

render_parent is not loaded by Redmine core but by your redmine_latex_mathjax plugin. You should try to upgrade your plugin.

#3 Updated by Go MAEDA 8 months ago

Nigel Wilson, thank you for reporting the problem regarding MS SQL Server. I have created another issue #30211.

Could you paste the crash log which includes "undefined method `alias_method_chain'" on #30211?

#4 Updated by Tobias Verbeke 8 months ago

Jean-Philippe Lang wrote:

render_parent is not loaded by Redmine core but by your redmine_latex_mathjax plugin. You should try to upgrade your plugin.

Thanks a lot for the quick feedback. I shared this with the plugin developer.

#5 Updated by Ivan Cenov about 1 month ago

Removing the "gem 'render_parent', '>= 0.0.4'" from plugin's Gemfile seem to fix it.

I tested on Redmine 4.0.4. See https://github.com/mboratko/redmine_latex_mathjax/issues/30

Also available in: Atom PDF