ports/www/gitlab/files/patch-config_puma.rb.example
Matthias Fechner 7040041239 www/gitlab: fix error uninitialized constant ActiveSupport::LoggerThreadSafeLevel::Logger
The upgrade of gem concurrent-ruby to 1.3.5 made a bug in activesupport visible.
The bug seems to be fixed for rails 7.1 and 7.2 but not 7.0 which gitlab uses.
https://github.com/rails/rails/pull/49372
https://github.com/rails/rails/issues/54260

So we import the Logger to fix the error message:
bundler: failed to load command: puma (/usr/local/bin/puma)
/usr/local/lib/ruby/gems/3.2/gems/activesupport-7.0.8.7/lib/active_support/logger_thread_safe_level.rb:12:in `<module:LoggerThreadSafeLevel>': uninitialized constant ActiveSupport::LoggerThreadSafeLevel::Logger (NameError)

    Logger::Severity.constants.each do |severity|
          ^^^^^^^^^^
        from /usr/local/lib/ruby/gems/3.2/gems/activesupport-7.0.8.7/lib/active_support/logger_thread_safe_level.rb:9:in `<module:ActiveSupport>'
        from /usr/local/lib/ruby/gems/3.2/gems/activesupport-7.0.8.7/lib/active_support/logger_thread_safe_level.rb:8:in `<top (required)>'
        from <internal:/usr/local/lib/ruby/site_ruby/3.2/rubygems/core_ext/kernel_require.rb>:37:in `require'
        from <internal:/usr/local/lib/ruby/site_ruby/3.2/rubygems/core_ext/kernel_require.rb>:37:in `require'
        from /usr/local/lib/ruby/gems/3.2/gems/activesupport-7.0.8.7/lib/active_support/logger_silence.rb:5:in `<top (required)>'
        from <internal:/usr/local/lib/ruby/site_ruby/3.2/rubygems/core_ext/kernel_require.rb>:37:in `require'
        from <internal:/usr/local/lib/ruby/site_ruby/3.2/rubygems/core_ext/kernel_require.rb>:37:in `require'
        from /usr/local/lib/ruby/gems/3.2/gems/activesupport-7.0.8.7/lib/active_support/logger.rb:3:in `<top (required)>'
        from <internal:/usr/local/lib/ruby/site_ruby/3.2/rubygems/core_ext/kernel_require.rb>:37:in `require'
        from <internal:/usr/local/lib/ruby/site_ruby/3.2/rubygems/core_ext/kernel_require.rb>:37:in `require'
        from /usr/local/lib/ruby/gems/3.2/gems/activesupport-7.0.8.7/lib/active_support.rb:29:in `<top (required)>'
        from <internal:/usr/local/lib/ruby/site_ruby/3.2/rubygems/core_ext/kernel_require.rb>:37:in `require'
        from <internal:/usr/local/lib/ruby/site_ruby/3.2/rubygems/core_ext/kernel_require.rb>:37:in `require'
        from /usr/local/lib/ruby/gems/3.2/gems/activesupport-7.0.8.7/lib/active_support/all.rb:3:in `<top (required)>'
        from <internal:/usr/local/lib/ruby/site_ruby/3.2/rubygems/core_ext/kernel_require.rb>:37:in `require'
        from <internal:/usr/local/lib/ruby/site_ruby/3.2/rubygems/core_ext/kernel_require.rb>:37:in `require'
        from /usr/local/www/gitlab/gems/gitlab-utils/lib/gitlab/utils.rb:4:in `<top (required)>'
        from /usr/local/www/gitlab/gems/gitlab-utils/lib/gitlab/utils/all.rb:3:in `require_relative'
        from /usr/local/www/gitlab/gems/gitlab-utils/lib/gitlab/utils/all.rb:3:in `<top (required)>'
        from <internal:/usr/local/lib/ruby/site_ruby/3.2/rubygems/core_ext/kernel_require.rb>:37:in `require'
        from <internal:/usr/local/lib/ruby/site_ruby/3.2/rubygems/core_ext/kernel_require.rb>:37:in `require'
        from /usr/local/www/gitlab/lib/gitlab/cluster/lifecycle_events.rb:3:in `<top (required)>'
        from /usr/local/www/gitlab/config/puma.rb:38:in `require_relative'
        from /usr/local/www/gitlab/config/puma.rb:38:in `_load_from'
        from /usr/local/lib/ruby/gems/3.2/gems/puma-6.5.0/lib/puma/dsl.rb:135:in `instance_eval'
        from /usr/local/lib/ruby/gems/3.2/gems/puma-6.5.0/lib/puma/dsl.rb:135:in `_load_from'
        from /usr/local/lib/ruby/gems/3.2/gems/puma-6.5.0/lib/puma/configuration.rb:246:in `block in load'
        from /usr/local/lib/ruby/gems/3.2/gems/puma-6.5.0/lib/puma/configuration.rb:246:in `each'
        from /usr/local/lib/ruby/gems/3.2/gems/puma-6.5.0/lib/puma/configuration.rb:246:in `load'
        from /usr/local/lib/ruby/gems/3.2/gems/puma-6.5.0/lib/puma/launcher.rb:56:in `initialize'
        from /usr/local/lib/ruby/gems/3.2/gems/puma-6.5.0/lib/puma/cli.rb:66:in `new'
        from /usr/local/lib/ruby/gems/3.2/gems/puma-6.5.0/lib/puma/cli.rb:66:in `initialize'
        from /usr/local/lib/ruby/gems/3.2/gems/puma-6.5.0/bin/puma:8:in `new'
        from /usr/local/lib/ruby/gems/3.2/gems/puma-6.5.0/bin/puma:8:in `<top (required)>'
        from /usr/local/bin/puma:25:in `load'
        from /usr/local/bin/puma:25:in `<top (required)>'
        from /usr/local/lib/ruby/gems/3.2/gems/bundler-2.6.3/lib/bundler/cli/exec.rb:59:in `load'
        from /usr/local/lib/ruby/gems/3.2/gems/bundler-2.6.3/lib/bundler/cli/exec.rb:59:in `kernel_load'
        from /usr/local/lib/ruby/gems/3.2/gems/bundler-2.6.3/lib/bundler/cli/exec.rb:23:in `run'
        from /usr/local/lib/ruby/gems/3.2/gems/bundler-2.6.3/lib/bundler/cli.rb:452:in `exec'
        from /usr/local/lib/ruby/gems/3.2/gems/bundler-2.6.3/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
        from /usr/local/lib/ruby/gems/3.2/gems/bundler-2.6.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
        from /usr/local/lib/ruby/gems/3.2/gems/bundler-2.6.3/lib/bundler/vendor/thor/lib/thor.rb:538:in `dispatch'
        from /usr/local/lib/ruby/gems/3.2/gems/bundler-2.6.3/lib/bundler/cli.rb:35:in `dispatch'
        from /usr/local/lib/ruby/gems/3.2/gems/bundler-2.6.3/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
        from /usr/local/lib/ruby/gems/3.2/gems/bundler-2.6.3/lib/bundler/cli.rb:29:in `start'
        from /usr/local/lib/ruby/gems/3.2/gems/bundler-2.6.3/exe/bundle:28:in `block in <top (required)>'
        from /usr/local/lib/ruby/gems/3.2/gems/bundler-2.6.3/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
        from /usr/local/lib/ruby/gems/3.2/gems/bundler-2.6.3/exe/bundle:20:in `<top (required)>'
        from /usr/local/bin/bundle:25:in `load'
        from /usr/local/bin/bundle:25:in `<main>'
2025-02-05 10:22:45 +02:00

58 lines
2 KiB
Text

--- config/puma.rb.example.orig 2025-01-22 04:13:11 UTC
+++ config/puma.rb.example
@@ -1,15 +1,20 @@
# frozen_string_literal: true
+# Required as rubygem-concurrent-ruby version 1.3.5 has remove logger, but is required by active_support
+# The fix has only applied to rails 7.1 and 7.2
+# https://github.com/rails/rails/pull/49372
+require "logger"
+
# Load "path" as a rackup file.
#
# The default is "config.ru".
#
rackup 'config.ru'
-pidfile '/home/git/gitlab/tmp/pids/puma.pid'
-state_path '/home/git/gitlab/tmp/pids/puma.state'
+pidfile '%%WWWDIR%%/tmp/pids/puma.pid'
+state_path '%%WWWDIR%%/tmp/pids/puma.state'
-stdout_redirect '/home/git/gitlab/log/puma.stdout.log',
- '/home/git/gitlab/log/puma.stderr.log',
+stdout_redirect '%%WWWDIR%%/log/puma.stdout.log',
+ '%%WWWDIR%%/log/puma.stderr.log',
true
# Configure "min" to be the minimum number of threads to use to answer
@@ -31,11 +36,11 @@ queue_requests false
# Bind the server to "url". "tcp://", "unix://" and "ssl://" are the only
# accepted protocols.
-bind 'unix:///home/git/gitlab/tmp/sockets/gitlab.socket'
+bind 'unix://%%WWWDIR%%/tmp/sockets/gitlab.socket'
workers 3
-require_relative "/home/git/gitlab/lib/gitlab/cluster/lifecycle_events"
+require_relative "%%WWWDIR%%/lib/gitlab/cluster/lifecycle_events"
on_restart do
# Signal application hooks that we're about to restart
@@ -74,14 +79,14 @@ wait_for_less_busy_worker ENV.fetch('PUMA_WAIT_FOR_LES
wait_for_less_busy_worker ENV.fetch('PUMA_WAIT_FOR_LESS_BUSY_WORKER', 0.001).to_f
# Use json formatter
-require_relative "/home/git/gitlab/lib/gitlab/puma_logging/json_formatter"
+require_relative "%%WWWDIR%%/lib/gitlab/puma_logging/json_formatter"
json_formatter = Gitlab::PumaLogging::JSONFormatter.new
log_formatter do |str|
json_formatter.call(str)
end
-require_relative "/home/git/gitlab/lib/gitlab/puma/error_handler"
+require_relative "%%WWWDIR%%/lib/gitlab/puma/error_handler"
error_handler = Gitlab::Puma::ErrorHandler.new(ENV['RAILS_ENV'] == 'production')