alphanodes / additionals

Redmine plugin for easy customization of settings, text and content display by using personal or role-based dashboards (drag&drop), providing wiki macros and act as library for other plugins.
https://www.redmine.org/plugins/additionals
GNU General Public License v2.0
131 stars 43 forks source link

Error Psych::DisallowedClass (Tried to load unspecified class: ActiveSupport::HashWithIndifferentAccess) #107

Closed shoorick closed 2 years ago

shoorick commented 3 years ago

Redmine 4.1.1 or 4.2.1 (with rvm and ruby 2.6.3 or 2.7.2 and the most recent Additionals) returns HTTP 500 Server Error

Psych::DisallowedClass (Tried to load unspecified class: ActiveSupport::HashWithIndifferentAccess):

app/models/setting.rb:108:in `value'
app/models/setting.rb:122:in `[]'
plugins/additionals/lib/additionals.rb:208:in `settings'
plugins/additionals/lib/additionals.rb:71:in `setting'
plugins/additionals/lib/additionals.rb:79:in `setting?'
plugins/additionals/lib/additionals/patches/application_controller_patch.rb:16:in `enable_smileys'
lib/redmine/sudo_mode.rb:61:in `sudo_mode'

Without Additionals it works.

alexandermeindl commented 3 years ago

Hi @shoorick,

which other plugins do you use? Did you try it without the other plugins? Do you use additionals stable or master version?

shoorick commented 3 years ago

Hi @alexandermeindl

Other plugins are

I've tried without these plugins, both stable and master version of Additionals, results are the same.

alexandermeindl commented 3 years ago

Hm, strange. I cannot reproduce this problem with rvm rubies. Is there anything else special with your installation? E.g. do you load Gems with Gemfile.local or any special configuration?

Your plugins should not have any problems with additionals plugin (these are very often used with it).

alexandermeindl commented 3 years ago

Hi @shoorick,

I found the cause of the problem. I could reproduce the error with

gem 'psych', '~> 4.0.0'

Plugins settings are broken with psych >= 4 at the moment with Redmine. See https://www.redmine.org/issues/35435

Additionals plugin do not set psych version, your problem is caused by any other setting or plugin in your installation.

shoorick commented 3 years ago

All other plugins are switched off, Psych version specified in Gemfile

gem 'psych', '~> 3.3'

gems fetched with bundle install but Redmine throws error and doesn’t start. I’ve tried different ways to spawn it but I haven’t any success. Here are commands and their output (paths are changed):

# service redmine-unicorn start
Job for redmine-unicorn.service failed. See 'systemctl status redmine-unicorn.service' and 'journalctl -xn' for details.

...
me@server:path/to/redmine $ tail -f log/unicorn.stderr.log

I, [2021-07-06T15:08:14.657659 #25180]  INFO -- : Refreshing Gem list
/usr/share/rvm/gems/ruby-2.6.3/gems/bundler-2.2.20/lib/bundler/runtime.rb:302:in `check_for_activated_spec!': You have already activated psych 4.0.1, but your Gemfile requires psych 3.3.2. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
        from /usr/share/rvm/gems/ruby-2.6.3/gems/bundler-2.2.20/lib/bundler/runtime.rb:31:in `block in setup'
        from /usr/share/rvm/gems/ruby-2.6.3/gems/bundler-2.2.20/lib/bundler/spec_set.rb:163:in `each'
        from /usr/share/rvm/gems/ruby-2.6.3/gems/bundler-2.2.20/lib/bundler/spec_set.rb:163:in `each'
        from /usr/share/rvm/gems/ruby-2.6.3/gems/bundler-2.2.20/lib/bundler/runtime.rb:26:in `map'
        from /usr/share/rvm/gems/ruby-2.6.3/gems/bundler-2.2.20/lib/bundler/runtime.rb:26:in `setup'
        from /usr/share/rvm/gems/ruby-2.6.3/gems/bundler-2.2.20/lib/bundler.rb:149:in `setup'
        from /usr/share/rvm/gems/ruby-2.6.3/gems/bundler-2.2.20/lib/bundler/setup.rb:20:in `block in <top (required)>'
        from /usr/share/rvm/gems/ruby-2.6.3/gems/bundler-2.2.20/lib/bundler/ui/shell.rb:136:in `with_level'
        from /usr/share/rvm/gems/ruby-2.6.3/gems/bundler-2.2.20/lib/bundler/ui/shell.rb:88:in `silence'
        from /usr/share/rvm/gems/ruby-2.6.3/gems/bundler-2.2.20/lib/bundler/setup.rb:20:in `<top (required)>'
        from /usr/share/rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /usr/share/rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from path/to/redmine/config/boot.rb:6:in `<top (required)>'
        from /usr/share/rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /usr/share/rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from path/to/redmine/config/application.rb:3:in `<top (required)>'
        from /usr/share/rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /usr/share/rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from path/to/redmine/config/environment.rb:4:in `<top (required)>'
        from /usr/share/rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /usr/share/rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from config.ru:4:in `block in <main>'
        from /usr/share/rvm/gems/ruby-2.6.3/gems/rack-2.2.3/lib/rack/builder.rb:125:in `instance_eval'
        from /usr/share/rvm/gems/ruby-2.6.3/gems/rack-2.2.3/lib/rack/builder.rb:125:in `initialize'
        from config.ru:1:in `new'
        from config.ru:1:in `<main>'
        from /usr/share/rvm/gems/ruby-2.6.3/gems/unicorn-6.0.0/lib/unicorn.rb:54:in `eval'
        from /usr/share/rvm/gems/ruby-2.6.3/gems/unicorn-6.0.0/lib/unicorn.rb:54:in `block in builder'
        from /usr/share/rvm/gems/ruby-2.6.3/gems/unicorn-6.0.0/lib/unicorn/http_server.rb:826:in `build_app!'
        from /usr/share/rvm/gems/ruby-2.6.3/gems/unicorn-6.0.0/lib/unicorn/http_server.rb:140:in `start'
        from /usr/share/rvm/gems/ruby-2.6.3/gems/unicorn-6.0.0/bin/unicorn:128:in `<top (required)>'
        from /usr/share/rvm/gems/ruby-2.6.3/bin/unicorn:23:in `load'
        from /usr/share/rvm/gems/ruby-2.6.3/bin/unicorn:23:in `<main>'
        from /usr/share/rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:22:in `eval'
        from /usr/share/rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:22:in `<main>'
me@server:path/to/redmine $ unicorn -D -E production -c path/to/_config/redmine-unicorn.rb
[DEPRECATED] Your Gemfile contains multiple primary sources. Using `source` more than once without a block is a security risk, and may result in installing unexpected gems. To resolve this warning, use a block to indicate which gems should come from the secondary source.
master failed to start, check stderr log for details

me@server:path/to/redmine $ bundle exec unicorn -D -E production -c path/to/_config/redmine-unicorn.rb
Traceback (most recent call last):
    12: from /usr/share/rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    11: from /usr/share/rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    10: from /usr/share/rvm/gems/ruby-2.6.3/gems/bundler-2.2.20/lib/bundler/setup.rb:10:in `<top (required)>'
     9: from /usr/share/rvm/gems/ruby-2.6.3/gems/bundler-2.2.20/lib/bundler/ui/shell.rb:88:in `silence'
     8: from /usr/share/rvm/gems/ruby-2.6.3/gems/bundler-2.2.20/lib/bundler/ui/shell.rb:136:in `with_level'
     7: from /usr/share/rvm/gems/ruby-2.6.3/gems/bundler-2.2.20/lib/bundler/setup.rb:10:in `block in <top (required)>'
     6: from /usr/share/rvm/gems/ruby-2.6.3/gems/bundler-2.2.20/lib/bundler.rb:149:in `setup'
     5: from /usr/share/rvm/gems/ruby-2.6.3/gems/bundler-2.2.20/lib/bundler/runtime.rb:26:in `setup'
     4: from /usr/share/rvm/gems/ruby-2.6.3/gems/bundler-2.2.20/lib/bundler/runtime.rb:26:in `map'
     3: from /usr/share/rvm/gems/ruby-2.6.3/gems/bundler-2.2.20/lib/bundler/spec_set.rb:163:in `each'
     2: from /usr/share/rvm/gems/ruby-2.6.3/gems/bundler-2.2.20/lib/bundler/spec_set.rb:163:in `each'
     1: from /usr/share/rvm/gems/ruby-2.6.3/gems/bundler-2.2.20/lib/bundler/runtime.rb:31:in `block in setup'
/usr/share/rvm/gems/ruby-2.6.3/gems/bundler-2.2.20/lib/bundler/runtime.rb:302:in `check_for_activated_spec!': You have already activated psych 4.0.1, but your Gemfile requires psych 3.3.2. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)

What can I do?

shoorick commented 3 years ago

Psych was uninstalled and then Redmine was started

$ gem uninstall psych -v 4.0.1
Successfully uninstalled psych-4.0.1
alexandermeindl commented 3 years ago

Try:

gem uninstall -a psych
bundle install

and restart your unicorn process. If this does not work, there has to be a configuration somewhere, which update psych.

Usegem dependency to find out more. Maybe another gem requires the new psych version.

shoorick commented 3 years ago
$ gem dependency

Gem psych-3.1.0
  minitest (~> 5.0, development)
  rake-compiler (>= 0.4.1, development)
  rake-compiler-dock (>= 0.6.3, development)

Gem psych-3.3.2
alexandermeindl commented 3 years ago
$ gem dependency

Gem psych-3.1.0
  minitest (~> 5.0, development)
  rake-compiler (>= 0.4.1, development)
  rake-compiler-dock (>= 0.6.3, development)

Gem psych-3.3.2

This look good to me. So, your Redmine is running again after uninstalling psych-4.0.1, right?

shoorick commented 3 years ago

Yes, our Redmine is running.