[DRE-maint] Bug#1120904: redmine plugins symlinked in REDMINE_INSTANCE/plugins have their files loaded twice

Alban Browaeys prahal at yahoo.com
Tue Nov 18 05:16:18 GMT 2025


Package: redmine
Version: 6.0.5+ds-1
Severity: normal

Dear Maintainer,
This is likely a local issue but in case it is not I open this report.
As reported in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1120894
when I symlinks my /usr/share/redmine/plugins/<x> (not /usr/share/redmine/plugins folder
but the plugin folders inside) into /var/lib/redmine/default/plugins (ie REDMINE_INSTANCE/plugins)
their files are loaded twice and as on is a derivative of Rails Concern it aborts loadig the redmine
app (tested in unicorn with a working_direcoty set to /usr/share/redmine. Also tested with rackup from /usr/share/redmine)

I fixed /usr/share/redmine/instances which now is a symlink to /var/lib/redmine as it is supposed to.

when I symlink additionals and redmine_git_hosting plugins from /usr/share/redmine/plugins/<x>
to /var/libredmine/default/plugins, restarting unicorn redmine errors out with:
phn at uruk:/var/lib/redmine/default/plugins$ tail -f /var/log/redmine/default/unicorn.stderr.log
I, [2025-11-18T05:03:49.677259 #1349]  INFO -- : Refreshing Gem list
I, [2025-11-18T05:04:21.183680 #1349]  INFO -- : unlinking existing socket=/var/cache/redmine/default/sockets/redmine.socket
I, [2025-11-18T05:04:21.185348 #1349]  INFO -- : listening on addr=/var/cache/redmine/default/sockets/redmine.socket fd=8
I, [2025-11-18T05:04:21.186670 #1349]  INFO -- : listening on addr=127.0.0.1:18083 fd=9
I, [2025-11-18T05:04:21.216671 #1349]  INFO -- : master process ready
I, [2025-11-18T05:04:21.272917 #1360]  INFO -- : worker=0 ready
sh: 1: gs: not found
I, [2025-11-18T05:05:04.294631 #1349]  INFO -- : reaped #<Process::Status: pid 1360 exit 0> worker=0
I, [2025-11-18T05:05:04.295004 #1349]  INFO -- : master complete
I, [2025-11-18T05:05:05.469626 #1434]  INFO -- : Refreshing Gem list

/usr/share/redmine/plugins/redmine_git_hosting/lib/redmine_git_hosting/file_logger.rb:7: warning: already initialized constant RedmineGitHosting::FileLogger::LOG_LEVELS
/usr/share/redmine/instances/default/plugins/redmine_git_hosting/lib/redmine_git_hosting/file_logger.rb:7: warning: previous definition of LOG_LEVELS was here
/usr/share/redmine/plugins/redmine_git_hosting/lib/redmine_git_hosting/git_access.rb:5: warning: already initialized constant RedmineGitHosting::GitAccess::DOWNLOAD_COMMANDS
/usr/share/redmine/instances/default/plugins/redmine_git_hosting/lib/redmine_git_hosting/git_access.rb:5: warning: previous definition of DOWNLOAD_COMMANDS was here
/usr/share/redmine/plugins/redmine_git_hosting/lib/redmine_git_hosting/git_access.rb:6: warning: already initialized constant RedmineGitHosting::GitAccess::PUSH_COMMANDS
/usr/share/redmine/instances/default/plugins/redmine_git_hosting/lib/redmine_git_hosting/git_access.rb:6: warning: previous definition of PUSH_COMMANDS was here
/usr/share/redmine/plugins/redmine_git_hosting/lib/redmine_git_hosting/mirror_keys_installer.rb:7: warning: already initialized constant RedmineGitHosting::MirrorKeysInstaller::GITOLITE_MIRRORING_KEYS_NAME
/usr/share/redmine/instances/default/plugins/redmine_git_hosting/lib/redmine_git_hosting/mirror_keys_installer.rb:7: warning: previous definition of GITOLITE_MIRRORING_KEYS_NAME was here
/usr/share/rubygems-integration/all/gems/activesupport-7.2.2.1/lib/active_support/concern.rb:162:in `included': Cannot define multiple 'included' blocks for a Concern (ActiveSupport::Concern::MultipleIncludedBlocks)
	from /usr/share/redmine/plugins/redmine_git_hosting/lib/redmine_git_hosting/patches/dashboard_content_project_patch.rb:8:in `<module:DashboardContentProjectPatch>'
	from /usr/share/redmine/plugins/redmine_git_hosting/lib/redmine_git_hosting/patches/dashboard_content_project_patch.rb:5:in `<module:Patches>'
	from /usr/share/redmine/plugins/redmine_git_hosting/lib/redmine_git_hosting/patches/dashboard_content_project_patch.rb:4:in `<module:RedmineGitHosting>'
	from /usr/share/redmine/plugins/redmine_git_hosting/lib/redmine_git_hosting/patches/dashboard_content_project_patch.rb:3:in `<top (required)>'
	from /usr/lib/ruby/3.3.0/bundled_gems.rb:69:in `require'
	from /usr/lib/ruby/3.3.0/bundled_gems.rb:69:in `block (2 levels) in replace_require'
	from /usr/share/rubygems-integration/all/gems/zeitwerk-2.6.8/lib/zeitwerk/kernel.rb:38:in `require'
	from /usr/lib/ruby/vendor_ruby/polyglot.rb:65:in `require'
	from /usr/share/rubygems-integration/all/gems/activesupport-7.2.2.1/lib/active_support/dependencies/require_dependency.rb:21:in `require_dependency'
	from /usr/share/redmine/instances/default/plugins/redmine_git_hosting/lib/redmine_git_hosting/redmine_plugin_loader.rb:127:in `block in autoload_libs!'
	from /usr/share/redmine/instances/default/plugins/redmine_git_hosting/lib/redmine_git_hosting/redmine_plugin_loader.rb:126:in `each'
	from /usr/share/redmine/instances/default/plugins/redmine_git_hosting/lib/redmine_git_hosting/redmine_plugin_loader.rb:126:in `autoload_libs!'
	from /usr/share/redmine/instances/default/plugins/redmine_git_hosting/lib/redmine_git_hosting/redmine_plugin_loader.rb:96:in `load_plugin!'
	from /usr/share/redmine/instances/default/plugins/redmine_git_hosting/init.rb:72:in `<top (required)>'
	from /usr/share/redmine/lib/redmine/plugin_loader.rb:31:in `load'
	from /usr/share/redmine/lib/redmine/plugin_loader.rb:31:in `run_initializer'
	from /usr/share/redmine/lib/redmine/plugin_loader.rb:67:in `each'
	from /usr/share/redmine/lib/redmine/plugin_loader.rb:67:in `block in load'
	from /usr/share/rubygems-integration/all/gems/activesupport-7.2.2.1/lib/active_support/callbacks.rb:407:in `instance_exec'
	from /usr/share/rubygems-integration/all/gems/activesupport-7.2.2.1/lib/active_support/callbacks.rb:407:in `block in make_lambda'
	from /usr/share/rubygems-integration/all/gems/activesupport-7.2.2.1/lib/active_support/callbacks.rb:179:in `block in call'
	from /usr/share/rubygems-integration/all/gems/activesupport-7.2.2.1/lib/active_support/callbacks.rb:668:in `block (2 levels) in default_terminator'
	from /usr/share/rubygems-integration/all/gems/activesupport-7.2.2.1/lib/active_support/callbacks.rb:667:in `catch'
	from /usr/share/rubygems-integration/all/gems/activesupport-7.2.2.1/lib/active_support/callbacks.rb:667:in `block in default_terminator'
	from /usr/share/rubygems-integration/all/gems/activesupport-7.2.2.1/lib/active_support/callbacks.rb:180:in `call'
	from /usr/share/rubygems-integration/all/gems/activesupport-7.2.2.1/lib/active_support/callbacks.rb:559:in `block in invoke_before'
	from /usr/share/rubygems-integration/all/gems/activesupport-7.2.2.1/lib/active_support/callbacks.rb:559:in `each'
	from /usr/share/rubygems-integration/all/gems/activesupport-7.2.2.1/lib/active_support/callbacks.rb:559:in `invoke_before'
	from /usr/share/rubygems-integration/all/gems/activesupport-7.2.2.1/lib/active_support/callbacks.rb:109:in `run_callbacks'
	from /usr/share/rubygems-integration/all/gems/activesupport-7.2.2.1/lib/active_support/reloader.rb:96:in `prepare!'
	from /usr/share/rubygems-integration/all/gems/railties-7.2.2.1/lib/rails/application/finisher.rb:74:in `block in <module:Finisher>'
	from /usr/share/rubygems-integration/all/gems/railties-7.2.2.1/lib/rails/initializable.rb:32:in `instance_exec'
	from /usr/share/rubygems-integration/all/gems/railties-7.2.2.1/lib/rails/initializable.rb:32:in `run'
	from /usr/share/rubygems-integration/all/gems/railties-7.2.2.1/lib/rails/initializable.rb:61:in `block in run_initializers'
	from /usr/lib/ruby/3.3.0/tsort.rb:231:in `block in tsort_each'
	from /usr/lib/ruby/3.3.0/tsort.rb:353:in `block (2 levels) in each_strongly_connected_component'
	from /usr/lib/ruby/3.3.0/tsort.rb:434:in `each_strongly_connected_component_from'
	from /usr/lib/ruby/3.3.0/tsort.rb:352:in `block in each_strongly_connected_component'
	from /usr/lib/ruby/3.3.0/tsort.rb:350:in `each'
	from /usr/lib/ruby/3.3.0/tsort.rb:350:in `call'
	from /usr/lib/ruby/3.3.0/tsort.rb:350:in `each_strongly_connected_component'
	from /usr/lib/ruby/3.3.0/tsort.rb:229:in `tsort_each'
	from /usr/lib/ruby/3.3.0/tsort.rb:208:in `tsort_each'
	from /usr/share/rubygems-integration/all/gems/railties-7.2.2.1/lib/rails/initializable.rb:60:in `run_initializers'
	from /usr/share/rubygems-integration/all/gems/railties-7.2.2.1/lib/rails/application.rb:435:in `initialize!'
	from /usr/share/redmine/config/environment.rb:16:in `<top (required)>'
	from config.ru:4:in `require_relative'
	from config.ru:4:in `block in <main>'
	from /usr/share/rubygems-integration/all/gems/rack-3.1.18/lib/rack/builder.rb:124:in `instance_eval'
	from /usr/share/rubygems-integration/all/gems/rack-3.1.18/lib/rack/builder.rb:124:in `initialize'
	from config.ru:1:in `new'
	from config.ru:1:in `<main>'
	from /usr/lib/ruby/vendor_ruby/unicorn.rb:54:in `eval'
	from /usr/lib/ruby/vendor_ruby/unicorn.rb:54:in `block in builder'
	from /usr/lib/ruby/vendor_ruby/unicorn/http_server.rb:790:in `build_app!'
	from /usr/lib/ruby/vendor_ruby/unicorn/http_server.rb:140:in `start'
	from /usr/bin/unicorn:129:in `<main>'


The issue is that the plugins files are loaded twice in unicorn. Once from /usr/share/redmine/plugins/redmine_git_hosting
and a second time from /usr/share/redmine/instances/default/plugins/redmine_git_hosting.
Note that if I dod not put symlink to the pluygins ins the REDMINE_INSTANCE/plugins folder unicorn load fine but no plugin is activated
in redmine at least in the adminsitraction dashboard > plugins.
If I remove the /var/lib/redmine/default/plugins directory the plugins are available at runtime in redmine.
I don't know how autoloading happens but it seems the fact /usr/share/redmine/instances is a symlink to /var/lib/redmine/default/plugins
which itslef holds symlinks to the /usr/share/redmine/plugins/<x> plugfin folder leads to them being autoloaded twice. Once from 
/usr/share/redmine/plugins/redmine_git_hosting and a second time from /usr/share/redmine/instances/default/plugins/redmine_git_hosting a symlink.

I probably have something local that leads to this double autoload but I have no clue what it can be.

I only have one instance enabled (default).
I have leftover files from a run where I tested adding a second test instance via dpkg-reconfigure redmine. I removed this "test"
instance entry from a followup dpkg-reconfigure redmine call.



rackup tested with:
sudo -u www-data REDMINE_INSTANCE=default rackup -E production



/etc/systemd/system/unicorn-redmine-default.service 
[Unit]
Description=Unicorn application server for Redmine instance 'default'
After=network.target mysql.service
Wants=network-online.target


[Service]
Environment=REDMINE_INSTANCE="default"
Environment=RAILS_ENV="production"
ExecStart=/usr/bin/unicorn -E production -c '/var/lib/redmine/default/config/unicorn.ru'
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-abort
User=redmine
Group=www-data

[Install]
WantedBy=multi-user.target




unicorn.ru:
"
# Ansible managed

# Sample verbose configuration file for Unicorn (not Rack)
#
# This configuration file documents many features of Unicorn
# that may not be needed for some applications. See
# http://unicorn.bogomips.org/examples/unicorn.conf.minimal.rb
# for a much simpler configuration file.
#
# See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete
# documentation.

# WARNING: See config/application.rb under "Relative url support" for the list of
# other files that need to be changed for relative url support
#
# ENV['RAILS_RELATIVE_URL_ROOT'] = "/redmine"

# Read about unicorn workers here:
# http://doc.redmine.com/ee/install/requirements.html#unicorn-workers
#
# FIXME: only 1 process for redmine/unicorn/nginx ? I only bind to one port per instance !
worker_processes 1

# Since Unicorn is never exposed to outside clients, it does not need to
# run on the standard HTTP port (80), there is no reason to start Unicorn
# as root unless it's from system init scripts.
# If running the master process as root and the workers as an unprivileged
# user, do this to switch euid/egid in the workers (also chowns logs):
# user "unprivileged_user", "unprivileged_group"
user "redmine", "www-data"

# Help ensure your application will always spawn in the symlinked
# "current" directory that Capistrano sets up.
working_directory "/usr/share/redmine" # available in 0.94.0+

# Listen on both a Unix domain socket and a TCP port.
# If you are load-balancing multiple Unicorn masters, lower the backlog
# setting to e.g. 64 for faster failover.
listen "/var/cache/redmine/default/sockets/redmine.socket", :backlog => 64
listen "127.0.0.1:18083", :tcp_nopush => true

# nuke workers after 30 seconds instead of 60 seconds (the default)
#
# NOTICE: git push over http depends on this value.
# If you want be able to push huge amount of data to git repository over http
# you will have to increase this value too.
#
# Example of output if you try to push 1GB repo to Redmine over http.
#   -> git push http://redmine.... master
#
#   error: RPC failed; result=18, HTTP code = 200
#   fatal: The remote end hung up unexpectedly
#   fatal: The remote end hung up unexpectedly
#
# For more information see http://stackoverflow.com/a/21682112/752049
#
timeout 600

# feel free to point this anywhere accessible on the filesystem
pid "/var/cache/redmine/default/pids/unicorn.pid"

# By default, the Unicorn logger will write to stderr.
# Additionally, some applications/frameworks log to stderr or stdout,
# so prevent them from going to /dev/null when daemonized here:
stderr_path "/var/lib/redmine/default/log/unicorn.stderr.log"
stdout_path "/var/lib/redmine/default/log/unicorn.stdout.log"

# combine Ruby 2.0.0dev or REE with "preload_app true" for memory savings
# http://rubyenterpriseedition.com/faq.html#adapt_apps_for_cow
preload_app true
GC.respond_to?(:copy_on_write_friendly=) and
  GC.copy_on_write_friendly = true

# Enable this flag to have unicorn test client connections by writing the
# beginning of the HTTP headers before calling the application.  This
# prevents calling the application for connections that have disconnected
# while queued.  This is only guaranteed to detect clients on the same
# host unicorn runs on, and unlikely to detect disconnects even on a
# fast LAN.
check_client_connection false

before_fork do |server, worker|
  # the following is highly recomended for Rails + "preload_app true"
  # as there's no need for the master process to hold a connection
  defined?(ActiveRecord::Base) and
    ActiveRecord::Base.connection.disconnect!

  # The following is only recommended for memory/DB-constrained
  # installations.  It is not needed if your system can house
  # twice as many worker_processes as you have configured.
  #
  # This allows a new master process to incrementally
  # phase out the old master process with SIGTTOU to avoid a
  # thundering herd (especially in the "preload_app false" case)
  # when doing a transparent upgrade.  The last worker spawned
  # will then kill off the old master process with a SIGQUIT.
  old_pid = "#{server.config[:pid]}.oldbin"
  if old_pid != server.pid
    begin
      sig = (worker.nr + 1) >= server.worker_processes ? :QUIT : :TTOU
      Process.kill(sig, File.read(old_pid).to_i)
    rescue Errno::ENOENT, Errno::ESRCH
    end
  end
  #
  # Throttle the master from forking too quickly by sleeping.  Due
  # to the implementation of standard Unix signal handlers, this
  # helps (but does not completely) prevent identical, repeated signals
  # from being lost when the receiving process is busy.
  # sleep 1
end

after_fork do |server, worker|
  # per-process listener ports for debugging/admin/migrations
  # addr = "127.0.0.1:#{9293 + worker.nr}"
  # server.listen(addr, :tries => -1, :delay => 5, :tcp_nopush => true)

  # the following is *required* for Rails + "preload_app true",
  defined?(ActiveRecord::Base) and
    ActiveRecord::Base.establish_connection

  # if preload_app is true, then you may also want to check and
  # restart any other shared sockets/descriptors such as Memcached,
  # and Redis.  TokyoCabinet file handles are safe to reuse
  # between any number of forked children (assuming your kernel
  # correctly implements pread()/pwrite() system calls)
end
"



Best Regards,
Alban


-- System Information:
Debian Release: 13.1
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'oldstable-updates'), (500, 'oldstable-security'), (500, 'stable'), (500, 'oldstable')
Architecture: armhf (armv7l)

Kernel: Linux 6.1.0-37-armmp (SMP w/4 CPU threads)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages redmine depends on:
ii  dbconfig-common                 2.0.25
ii  debconf [debconf-2.0]           1.5.91
ii  libjs-chart.js                  3.9.1+~cs3.1.2-3
ii  libjs-jquery                    3.6.1+dfsg+~3.5.14-1
ii  libjs-jquery-ui                 1.13.2+dfsg-1
ii  libjs-raphael                   2.3.0-4
ii  puma                            6.6.0-4
ii  redmine-pgsql                   6.0.5+ds-1
ii  ruby                            1:3.3+b1
ii  ruby-actionpack-action-caching  1.2.2-4
ii  ruby-actionpack-xml-parser      2.0.1-5
ii  ruby-addressable                2.8.7-2
ii  ruby-bundler                    2.6.7-2
ii  ruby-capybara                   3.40.0+ds-2
ii  ruby-coderay                    1.1.3-8
ii  ruby-commonmarker               0.23.10-1+b3
ii  ruby-csv                        3.3.4-1
ii  ruby-html-pipeline              2.14.3-2
ii  ruby-i18n                       1.14.7-1
ii  ruby-jquery-rails               4.3.5-5
ii  ruby-listen                     3.9.0-1
ii  ruby-mail                       2.8.1+dfsg1-2
ii  ruby-marcel                     1.0.4+dfsg-2
ii  ruby-mini-magick                5.2.0-1
ii  ruby-mini-mime                  1.1.5-1
ii  ruby-mocha                      2.4.2-2
ii  ruby-net-ldap                   0.19.0-1
ii  ruby-nokogiri                   1.18.2+dfsg-1+b1
ii  ruby-rack                       3.1.18-1~deb13u1
ii  ruby-rails                      2:7.2.2.1+dfsg-7
ii  ruby-rails-dom-testing          2.2.0-1
ii  ruby-rails-observers            0.1.5-1.1
ii  ruby-rails-propshaft            1.1.0-3
ii  ruby-rbpdf                      1.21.3+dfsg-1
ii  ruby-redcarpet                  3.6.0-1+b5
ii  ruby-rmagick                    6.0.1-3
ii  ruby-roadie                     5.2.1-2
ii  ruby-roadie-rails               3.3.0-2
ii  ruby-rotp                       6.2.0-2
ii  ruby-rouge                      4.5.1-1
ii  ruby-rqrcode                    2.2.0-1
ii  ruby-sanitize                   7.0.0-1
ii  ruby-selenium-webdriver         4.4.0-1
ii  ruby-simplecov                  0.22.0-2
ii  ruby-task-list                  2.3.2-2
ii  ruby-zip                        2.3.2-1

Versions of packages redmine recommends:
pn  passenger  <none>

Versions of packages redmine suggests:
pn  apache2                   <none>
ii  brz [bzr]                 3.3.11-1
ii  bzr                       2.7.0+bzr6622+brz
pn  cvs                       <none>
pn  darcs                     <none>
ii  git                       1:2.47.3-0+deb13u1
pn  libapache2-mod-passenger  <none>
ii  mercurial                 7.0.1-2
ii  subversion                1.14.5-3

-- Configuration Files:
/etc/default/redmine changed:
REDMINE_INSTANCES_OWNERSHIP=redmine:www-data
REDMINE_INSTANCES_FOLLOW_FHS=yes
REDMINE_INSTANCES_ROOT=/var/lib/redmine


-- debconf information:
  redmine/missing-redmine-package:
  redmine/instances/default/dbconfig-remove:
  redmine/instances/default/pgsql/changeconf: false
  redmine/instances/default/passwords-do-not-match:
* redmine/instances/default/mysql/admin-user: debian-sys-maint
  redmine/instances/default/pgsql/manualconf:
* redmine/instances/default/dbconfig-reinstall: false
* redmine/instances/default/db/app-user: redmine_default at localhost
* redmine/instances/default/db/dbname: redmine_default
  redmine/instances/default/remove-error: abort
* redmine/instances/default/dbconfig-install: true
* redmine/current-instances: default
  redmine/instances/default/db/basepath:
* redmine/instances/default/remote/port: 3306
* redmine/instances/default/pgsql/admin-user: debian-sys-maint
  redmine/instances/default/internal/skip-preseed: false
* redmine/instances/default/pgsql/authmethod-admin: ident
* redmine/instances/default/default-language: en
  redmine/instances/default/internal/reconfiguring: false
* redmine/instances/default/pgsql/authmethod-user: password
  redmine/instances/default/pgsql/no-empty-passwords:
* redmine/instances/default/pgsql/method: TCP/IP
* redmine/instances/default/remote/host: localhost
  redmine/notify-migration:
  redmine/instances/default/mysql/method: Unix socket
  redmine/instances/default/purge: false
  redmine/instances/default/upgrade-error: abort
  redmine/instances/default/install-error: abort
  redmine/instances/default/remote/newhost: localhost
* redmine/instances/default/database-type: pgsql
  redmine/instances/default/upgrade-backup: true
  redmine/instances/default/dbconfig-upgrade: true
  redmine/instances/default/missing-db-package-error: abort
  redmine/default-language: en
  redmine/old-instances:



More information about the Pkg-ruby-extras-maintainers mailing list