Check Puma.respond_to?(:cli_config) first
What does this MR do?
@jejacks0n noted (and I can replicate) that when running bundle exec rails
in the gitlab/
directory the following occurs:
$ bundle exec rails server
{"timestamp":"2021-02-19T02:12:50.174Z","pid":48312,"message":"PumaWorkerKiller: Out of memory. 3 workers consuming total: 7906.125 mb out of max: 4578.5599999999995 mb. Sending TERM to pid 48887 consuming 1976.53125 mb."}
{"timestamp":"2021-02-19T02:12:50.481Z","pid":48312,"message":"- Worker 2 (PID: 49250) booted, phase: 0"}
=> Booting Puma
=> Rails 6.0.3.4 application starting in development
=> Run `rails server --help` for more startup options
/Users/ash/src/gitlab/gitlab-development-kit/gitlab/lib/gitlab/cluster/lifecycle_events.rb:69: warning: already initialized constant Gitlab::Cluster::LifecycleEvents::FatalError
/Users/ash/src/gitlab/gitlab-development-kit/gitlab/lib/gitlab/cluster/lifecycle_events.rb:69: warning: previous definition of FatalError was here
/Users/ash/src/gitlab/gitlab-development-kit/gitlab/lib/gitlab/cluster/lifecycle_events.rb:71: warning: already initialized constant Gitlab::Cluster::LifecycleEvents::USE_FATAL_LIFECYCLE_EVENTS
/Users/ash/src/gitlab/gitlab-development-kit/gitlab/lib/gitlab/cluster/lifecycle_events.rb:71: warning: previous definition of USE_FATAL_LIFECYCLE_EVENTS was here
{"timestamp":"2021-02-19T02:12:56.709Z","pid":49091,"message":"Puma starting in cluster mode..."}
{"timestamp":"2021-02-19T02:12:56.709Z","pid":49091,"message":"* Puma version: 5.1.1 (ruby 2.7.2-p137) (\"At Your Service\")"}
{"timestamp":"2021-02-19T02:12:56.709Z","pid":49091,"message":"* Min threads: 3"}
{"timestamp":"2021-02-19T02:12:56.709Z","pid":49091,"message":"* Max threads: 3"}
{"timestamp":"2021-02-19T02:12:56.709Z","pid":49091,"message":"* Environment: development"}
{"timestamp":"2021-02-19T02:12:56.709Z","pid":49091,"message":"* Master PID: 49091"}
{"timestamp":"2021-02-19T02:12:56.709Z","pid":49091,"message":"* Workers: 3"}
{"timestamp":"2021-02-19T02:12:56.709Z","pid":49091,"message":"* Restarts: (✔) hot (✖) phased"}
{"timestamp":"2021-02-19T02:12:56.709Z","pid":49091,"message":"* Preloading application"}
{"timestamp":"2021-02-19T02:12:56.713Z","pid":49091,"message":"* Listening on http://127.0.0.1:3001"}
{"timestamp":"2021-02-19T02:12:56.713Z","pid":49091,"message":"Use Ctrl-C to stop"}
ERROR: The hook before_fork_hooks failed with exception (NoMethodError) "undefined method `cli_config' for Puma:Module".
Exiting
Traceback (most recent call last):
34: from bin/rails:4:in `<main>'
33: from /Users/ash/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:324:in `require'
32: from /Users/ash/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:291:in `load_dependency'
31: from /Users/ash/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:324:in `block in require'
30: from /Users/ash/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
29: from /Users/ash/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
28: from /Users/ash/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
27: from /Users/ash/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
26: from /Users/ash/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
25: from /Users/ash/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/railties-6.0.3.4/lib/rails/commands.rb:18:in `<main>'
24: from /Users/ash/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/railties-6.0.3.4/lib/rails/command.rb:46:in `invoke'
23: from /Users/ash/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/railties-6.0.3.4/lib/rails/command/base.rb:69:in `perform'
22: from /Users/ash/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
21: from /Users/ash/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
20: from /Users/ash/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
19: from /Users/ash/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/railties-6.0.3.4/lib/rails/commands/server/server_command.rb:138:in `perform'
18: from /Users/ash/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/railties-6.0.3.4/lib/rails/commands/server/server_command.rb:138:in `tap'
17: from /Users/ash/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/railties-6.0.3.4/lib/rails/commands/server/server_command.rb:147:in `block in perform'
16: from /Users/ash/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/railties-6.0.3.4/lib/rails/commands/server/server_command.rb:39:in `start'
15: from /Users/ash/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/rack-2.2.3/lib/rack/server.rb:327:in `start'
14: from /Users/ash/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/puma-5.1.1/lib/rack/handler/puma.rb:71:in `run'
13: from /Users/ash/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/puma-5.1.1/lib/puma/launcher.rb:182:in `run'
12: from /Users/ash/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/puma-5.1.1/lib/puma/cluster.rb:395:in `run'
11: from /Users/ash/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/puma-5.1.1/lib/puma/configuration.rb:289:in `run_hooks'
10: from /Users/ash/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/puma-5.1.1/lib/puma/configuration.rb:289:in `each'
9: from /Users/ash/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/puma-5.1.1/lib/puma/configuration.rb:291:in `block in run_hooks'
8: from config/puma.rb:60:in `block in _load_from'
7: from /Users/ash/src/gitlab/gitlab-development-kit/gitlab/lib/gitlab/cluster/lifecycle_events.rb:124:in `do_before_fork'
6: from /Users/ash/src/gitlab/gitlab-development-kit/gitlab/lib/gitlab/cluster/lifecycle_events.rb:155:in `call'
5: from /Users/ash/src/gitlab/gitlab-development-kit/gitlab/lib/gitlab/cluster/lifecycle_events.rb:155:in `each'
4: from /Users/ash/src/gitlab/gitlab-development-kit/gitlab/lib/gitlab/cluster/lifecycle_events.rb:156:in `block in call'
3: from /Users/ash/src/gitlab/gitlab-development-kit/gitlab/config/initializers/health_check.rb:15:in `block in <main>'
2: from /Users/ash/src/gitlab/gitlab-development-kit/gitlab/lib/gitlab/health_checks/master_check.rb:19:in `register_master'
1: from /Users/ash/src/gitlab/gitlab-development-kit/gitlab/lib/gitlab/health_checks/master_check.rb:15:in `available?'
/Users/ash/src/gitlab/gitlab-development-kit/gitlab/lib/gitlab/runtime.rb:85:in `puma_in_clustered_mode?': undefined method `cli_config' for Puma:Module (NoMethodError)
When running gdk start rails-web
or bundle exec puma
the above error does not appear.
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Edited by Kamil Trzciński (Back 2025-01-01)