From 139cf9a7527fd5b1fac05a918fe7a6051cab14a4 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Fri, 28 Apr 2023 23:00:25 -0700 Subject: [PATCH] Make it possible to run Puma v6 Puma v6.0 dropped `nakayoshi_fork` in https://github.com/puma/puma/issues/2925 since "it has very minimal gain and can trigger nasty bugs in c-extensions due to usage of GC.compact." If the call to `nakayoshi_fork` is made with Puma 6, the Web server will crash and fail to start up. To avoid this, conditionally enable it only if Puma v5 is loaded. Related merge requests: * https://gitlab.com/gitlab-org/gitlab/-/merge_requests/119137 * https://gitlab.com/gitlab-org/omnibus-gitlab/-/merge_requests/6854 Changelog: fixed --- gitlab-webservice/configuration/puma.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gitlab-webservice/configuration/puma.rb b/gitlab-webservice/configuration/puma.rb index a1b5071d5..c0b4ab4cd 100644 --- a/gitlab-webservice/configuration/puma.rb +++ b/gitlab-webservice/configuration/puma.rb @@ -111,8 +111,12 @@ worker_timeout (ENV['WORKER_TIMEOUT'] ||= '60').to_i # https://github.com/puma/puma/blob/master/5.0-Upgrade.md#lower-latency-better-throughput wait_for_less_busy_worker (ENV['PUMA_WAIT_FOR_LESS_BUSY_WORKER'] ||= '0.001').to_f +# nakayoshi_fork was removed in Puma 6.0: https://github.com/puma/puma/issues/2258 # https://github.com/puma/puma/blob/master/5.0-Upgrade.md#nakayoshi_fork -nakayoshi_fork unless ENV['DISABLE_PUMA_NAKAYOSHI_FORK'] == 'true' +if Gem::Version.new(Puma::Const::PUMA_VERSION).canonical_segments.first == 5 && + ENV['DISABLE_PUMA_NAKAYOSHI_FORK'] != 'true' + nakayoshi_fork +end # Use json formatter require_relative "/srv/gitlab/lib/gitlab/puma_logging/json_formatter" -- GitLab