Closed mbecca closed 1 year ago
At a first sight, it looks like the patch module is included twice, which makes me think that the Bitnami stack implements class loading a bit differently than plain Redmine with Zeitwerk, and that it loads plugin modules the old way .
You may look in the initializer files if you find anything like
config.autoloader = :classic
and comment it. This might have helped Bitnami to keep compatibility with plugins that are not aligned to Zeitwerk yet.
You may also try to comment the line
require_relative 'lib/extended_watchers_issue_patch'
into the plugin's init.rb; however, this breaks my installation as well as all Redmine installations that do not hack the initializers.
You may validate your environment like suggested in https://guides.rubyonrails.org/classic_to_zeitwerk_howto.html :
bin/rails runner 'p Rails.autoloaders.zeitwerk_enabled?'
Hi @maxrossello , thanks for your answer.
I made it work by commenting out the following lines:
Do you have any idea what the explanation is?
Best regards,
M.
You may validate your environment like suggested in https://guides.rubyonrails.org/classic_to_zeitwerk_howto.html :
bin/rails runner 'p Rails.autoloaders.zeitwerk_enabled?'
If you follow these instructions you can validate my hypothesis.
I believe that Bitnami cut short with old plugins compatibility (i.e. those able to run over Redmine 4.2) by disabling Zeitwerk autoloading. But, this isn't compatible with plugins that are refreshed to work with Zeitwerk which doesn't have the plugins folder in the autoload path, and that therefore requires the require_relative
statements
Thanks for creating this lovely plugin. I can confirm that this not an isolated case and it also occurs without bitnami.
OS Debian 11 x64 rails 6.1.7 ruby 2.7.4p191 redmine 5.0.4 Branch 5.0-extended_watchers
On Debian 11 with the gems installed globally via bundle install, I get this error as long as your redmine_extended_watchers is included in the plugin directry:
user@redminebox:/srv/somedir/redmine$ bundle exec rake redmine:plugins:migrate RAILS_ENV=production rake aborted! ActiveSupport::Concern::MultipleIncludedBlocks: Cannot define multiple 'included' blocks for a Concern /var/lib/gems/2.7.0/gems/activesupport-6.1.7/lib/active_support/concern.rb:160:in
included'
/srv/somedir/redmine_extended_watchers/lib/extended_watchers_issue_patch.rb:170:in <module:ExtendedWatchersIssueQueryClassPatch>' /srv/somedir/redmine_extended_watchers/lib/extended_watchers_issue_patch.rb:166:in
<top (required)>' /srv/somedir/redmine/plugins/redmine_extended_watchers/init.rb:22:in
require_relative'
/srv/somedir/redmine/plugins/redmine_extended_watchers/init.rb:22:in <top (required)>' /srv/somedir/redmine/lib/redmine/plugin_loader.rb:31:in
load'
/srv/somedir/redmine/lib/redmine/plugin_loader.rb:31:in run_initializer' /srv/somedir/redmine/lib/redmine/plugin_loader.rb:108:in
each'
/srv/somedir/redmine/lib/redmine/plugin_loader.rb:108:in block in load' /var/lib/gems/2.7.0/gems/activesupport-6.1.7/lib/active_support/callbacks.rb:427:in
instance_exec'
/var/lib/gems/2.7.0/gems/activesupport-6.1.7/lib/active_support/callbacks.rb:427:in block in make_lambda' /var/lib/gems/2.7.0/gems/activesupport-6.1.7/lib/active_support/callbacks.rb:198:in
block (2 levels) in halting'
/var/lib/gems/2.7.0/gems/activesupport-6.1.7/lib/active_support/callbacks.rb:604:in block (2 levels) in default_terminator' /var/lib/gems/2.7.0/gems/activesupport-6.1.7/lib/active_support/callbacks.rb:603:in
catch'
/var/lib/gems/2.7.0/gems/activesupport-6.1.7/lib/active_support/callbacks.rb:603:in block in default_terminator' /var/lib/gems/2.7.0/gems/activesupport-6.1.7/lib/active_support/callbacks.rb:199:in
block in halting'
/var/lib/gems/2.7.0/gems/activesupport-6.1.7/lib/active_support/callbacks.rb:512:in block in invoke_before' /var/lib/gems/2.7.0/gems/activesupport-6.1.7/lib/active_support/callbacks.rb:512:in
each'
/var/lib/gems/2.7.0/gems/activesupport-6.1.7/lib/active_support/callbacks.rb:512:in invoke_before' /var/lib/gems/2.7.0/gems/activesupport-6.1.7/lib/active_support/callbacks.rb:105:in
run_callbacks'
/var/lib/gems/2.7.0/gems/activesupport-6.1.7/lib/active_support/reloader.rb:88:in prepare!' /var/lib/gems/2.7.0/gems/railties-6.1.7/lib/rails/application/finisher.rb:124:in
block in instance_exec' /var/lib/gems/2.7.0/gems/railties-6.1.7/lib/rails/initializable.rb:32:in
run'
/var/lib/gems/2.7.0/gems/railties-6.1.7/lib/rails/initializable.rb:61:in block in run_initializers' /var/lib/gems/2.7.0/gems/railties-6.1.7/lib/rails/initializable.rb:60:in
run_initializers'
/var/lib/gems/2.7.0/gems/railties-6.1.7/lib/rails/application.rb:391:in initialize!' /srv/somedir/redmine/config/environment.rb:16:in
<top (required)>'
/var/lib/gems/2.7.0/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in require' /var/lib/gems/2.7.0/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in
require'
/var/lib/gems/2.7.0/gems/activesupport-6.1.7/lib/active_support/dependencies.rb:332:in block in require' /var/lib/gems/2.7.0/gems/activesupport-6.1.7/lib/active_support/dependencies.rb:299:in
load_dependency'
/var/lib/gems/2.7.0/gems/activesupport-6.1.7/lib/active_support/dependencies.rb:332:in require' /var/lib/gems/2.7.0/gems/railties-6.1.7/lib/rails/application.rb:367:in
require_environment!'
/var/lib/gems/2.7.0/gems/railties-6.1.7/lib/rails/application.rb:533:in block in run_tasks_blocks' /var/lib/gems/2.7.0/gems/rake-13.0.6/exe/rake:27:in
<top (required)>'
Tasks: TOP => redmine:plugins:migrate => environment
(See full trace by running task with --trace)
`
RAILS_ENV=production bundle exec bin/rails runner 'p Rails.autoloaders.zeitwerk_enabled?'
results in basically the same error.
After I unlink redmine_extended_watchers from the plugins directory, the same command RAILS_ENV=production bundle exec bin/rails runner 'p Rails.autoloaders.zeitwerk_enabled?' returns "true"
Ok this looks like an issue against Redmine 5.0.4. For some reason I hadn't received any notification from redmine.org news watching since 5.0.2. Let me process the new release, then in case you may open a dedicated issue. Thanks
@RolfWojtech I am not anyway experiencing anything weird. Please try to git pull the 5.0-extended_watchers branch or to use a defined release. The 5.0.2 release works fine against 5.0.4.
As I wrote in my original post, I am using the 5.0-extended_watchers branch already. I also extracted the 5.0.2 release to compare with and it does match the branch exactly. So at least on my system, the 5.0.2 does not work against 5.0.4.
Hi,
We use a Bitnami Redmine 5.0.2 docker version (docker.io/bitnami/redmine:5.0.2), and we have the follow exception when upgrade this plugin to 5.0.2:
rake aborted! ActiveSupport::Concern::MultipleIncludedBlocks: Cannot define multiple 'included' blocks for a Concern /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/concern.rb:160:in `included' /bitnami/redmine/plugins/redmine_extended_watchers/lib/extended_watchers_issue_patch.rb:170:in `<module:ExtendedWatchersIssueQueryClassPatch>' /bitnami/redmine/plugins/redmine_extended_watchers/lib/extended_watchers_issue_patch.rb:166:in `<module:ExtendedWatchersIssuePatch>' /bitnami/redmine/plugins/redmine_extended_watchers/lib/extended_watchers_issue_patch.rb:28:in `<top (required)>' /opt/bitnami/redmine/plugins/redmine_extended_watchers/init.rb:22:in `require_relative' /opt/bitnami/redmine/plugins/redmine_extended_watchers/init.rb:22:in `<top (required)>' /opt/bitnami/redmine/lib/redmine/plugin_loader.rb:31:in `load' /opt/bitnami/redmine/lib/redmine/plugin_loader.rb:31:in `run_initializer' /opt/bitnami/redmine/lib/redmine/plugin_loader.rb:108:in `each' /opt/bitnami/redmine/lib/redmine/plugin_loader.rb:108:in `block in load' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/callbacks.rb:427:in `instance_exec' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/callbacks.rb:427:in `block in make_lambda' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/callbacks.rb:198:in `block (2 levels) in halting' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/callbacks.rb:604:in `block (2 levels) in default_terminator' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/callbacks.rb:603:in `catch' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/callbacks.rb:603:in `block in default_terminator' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/callbacks.rb:199:in `block in halting' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/callbacks.rb:512:in `block in invoke_before' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/callbacks.rb:512:in `each' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/callbacks.rb:512:in `invoke_before' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/callbacks.rb:105:in `run_callbacks' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/reloader.rb:88:in `prepare!' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/railties-6.1.6/lib/rails/application/finisher.rb:124:in `block in <module:Finisher>' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/railties-6.1.6/lib/rails/initializable.rb:32:in `instance_exec' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/railties-6.1.6/lib/rails/initializable.rb:32:in `run' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/railties-6.1.6/lib/rails/initializable.rb:61:in `block in run_initializers' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/railties-6.1.6/lib/rails/initializable.rb:60:in `run_initializers' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/railties-6.1.6/lib/rails/application.rb:391:in `initialize!' /opt/bitnami/redmine/config/environment.rb:16:in `<top (required)>' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.0/lib/zeitwerk/kernel.rb:35:in `require' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/dependencies.rb:332:in `block in require' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/dependencies.rb:299:in `load_dependency' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/dependencies.rb:332:in `require' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/railties-6.1.6/lib/rails/application.rb:367:in `require_environment!' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/railties-6.1.6/lib/rails/application.rb:533:in `block in run_tasks_blocks' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/bundler-2.3.19/lib/bundler/cli/exec.rb:58:in `load' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/bundler-2.3.19/lib/bundler/cli/exec.rb:58:in `kernel_load' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/bundler-2.3.19/lib/bundler/cli/exec.rb:23:in `run' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/bundler-2.3.19/lib/bundler/cli.rb:483:in `exec' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/bundler-2.3.19/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/bundler-2.3.19/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/bundler-2.3.19/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/bundler-2.3.19/lib/bundler/cli.rb:31:in `dispatch' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/bundler-2.3.19/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/bundler-2.3.19/lib/bundler/cli.rb:25:in `start' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/bundler-2.3.19/exe/bundle:48:in `block in <top (required)>' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/bundler-2.3.19/lib/bundler/friendly_errors.rb:120:in `with_friendly_errors' /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/bundler-2.3.19/exe/bundle:36:in `<top (required)>' /opt/bitnami/ruby/bin/bundle:25:in `load' /opt/bitnami/ruby/bin/bundle:25:in `<main>' Tasks: TOP => db:migrate => db:load_config => environment
Any ideas?
Best regards,
M.