From 07a8c9553f6b5af1929bd0a5449a529fa5bc448d Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Thu, 18 May 2023 12:53:30 -0700 Subject: [PATCH] Upgrade to Puma v6.2.2 This release has numerous bug and performance fixes: https://github.com/puma/puma/releases Noteable changes: * nakayoshi_fork has been removed (https://github.com/puma/puma/issues/2258). With compaction disabled, it appears not to provide much gain. * https://github.com/puma/puma/pull/3035 dropped the use of the `time` gem in Puma, but our Puma JSON-formatter needs it. Changelog: changed --- Gemfile | 2 +- Gemfile.checksum | 4 ++-- Gemfile.lock | 4 ++-- .../003_gc_compact.rb | 21 ------------------- config/puma.example.development.rb | 7 ------- config/puma.rb.example | 7 ------- 6 files changed, 5 insertions(+), 40 deletions(-) delete mode 100644 config/initializers_before_autoloader/003_gc_compact.rb diff --git a/Gemfile b/Gemfile index 5ae0351404b65d..043dd49810b7b7 100644 --- a/Gemfile +++ b/Gemfile @@ -210,7 +210,7 @@ gem 'rack', '~> 2.2.7' gem 'rack-timeout', '~> 0.6.3', require: 'rack/timeout/base' group :puma do - gem 'puma', '~> 5.6.5', require: false + gem 'puma', '~> 6.2', require: false gem 'sd_notify', '~> 0.1.0', require: false end diff --git a/Gemfile.checksum b/Gemfile.checksum index d039c3365810b0..abb611df18735e 100644 --- a/Gemfile.checksum +++ b/Gemfile.checksum @@ -463,8 +463,8 @@ {"name":"pry-rails","version":"0.3.9","platform":"ruby","checksum":"468662575abb6b67f4a9831219f99290d5eae7bf186e64dd810d0a3e4a8cc4b1"}, {"name":"pry-shell","version":"0.6.1","platform":"ruby","checksum":"a99a6b3dffe4df274ea1751866816906861a23851f13346e10a8e8f61b53360c"}, {"name":"public_suffix","version":"5.0.0","platform":"ruby","checksum":"26ee4fbce33ada25eb117ac71f2c24bf4d8b3414ab6b34f05b4708a3e90f1c6b"}, -{"name":"puma","version":"5.6.5","platform":"java","checksum":"29d78fc2bc070b9db285a3334a890c3e0ece9bb369388065f0f340ccb1e57faf"}, -{"name":"puma","version":"5.6.5","platform":"ruby","checksum":"661029d15a115e9f6c0641a69c830ffd9f1b9ac63fcd0791d94ccd900e03f863"}, +{"name":"puma","version":"6.2.2","platform":"java","checksum":"979623e8072876a1d44092f91dfaddf337be103323b321fe779adc92def7106a"}, +{"name":"puma","version":"6.2.2","platform":"ruby","checksum":"4503e79d1d9f13985a30928c72cd1518cebf1da5fcf720efd1aa21ef6795c479"}, {"name":"pyu-ruby-sasl","version":"0.0.3.3","platform":"ruby","checksum":"5683a6bc5738db5a1bf5ceddeaf545405fb241b4184dd4f2587e679a7e9497e5"}, {"name":"raabro","version":"1.4.0","platform":"ruby","checksum":"d4fa9ff5172391edb92b242eed8be802d1934b1464061ae5e70d80962c5da882"}, {"name":"racc","version":"1.6.2","platform":"java","checksum":"0880781e7dfde09e665d0b6160b583e01ed52fcc2955d7891447d33c2d1d2cf1"}, diff --git a/Gemfile.lock b/Gemfile.lock index 4ee7c59ba2d9ae..335e5ffab403c4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1160,7 +1160,7 @@ GEM tty-markdown tty-prompt public_suffix (5.0.0) - puma (5.6.5) + puma (6.2.2) nio4r (~> 2.0) pyu-ruby-sasl (0.0.3.3) raabro (1.4.0) @@ -1863,7 +1863,7 @@ DEPENDENCIES pry-byebug pry-rails (~> 0.3.9) pry-shell (~> 0.6.1) - puma (~> 5.6.5) + puma (~> 6.2) rack (~> 2.2.7) rack-attack (~> 6.6.1) rack-cors (~> 1.1.1) diff --git a/config/initializers_before_autoloader/003_gc_compact.rb b/config/initializers_before_autoloader/003_gc_compact.rb deleted file mode 100644 index 6b5d49d79abbd8..00000000000000 --- a/config/initializers_before_autoloader/003_gc_compact.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -# Be sure to restart your server when you modify this file. -# -# Disables `GC.compact` method via monkey-patching. -# This is temporary measure to deal with reguarly appearing compacting issues (resulting in segfaults) in external gems. -# Having this patch allow using `nakayoshi_fork` in `config/puma.rb`, -# only without `GC.compact` (still invoking 4 GC cycles). -# Refer to for details: https://github.com/puma/puma/blob/80274413b04fae77cac7a7fecab7d6e89204343b/lib/puma/util.rb#L27 - -# rubocop:disable Rails/Output -module NakayoshiForkCompacting - module MonkeyPatch - def compact - puts 'Note: GC compacting is currently disabled.'\ - ' Refer to `config/initializers_before_autoloader/003_gc_compact.rb` for details.' - end - end -end - -GC.singleton_class.prepend NakayoshiForkCompacting::MonkeyPatch diff --git a/config/puma.example.development.rb b/config/puma.example.development.rb index 1183e3d75cfc3f..e7dacc70c2e6ce 100644 --- a/config/puma.example.development.rb +++ b/config/puma.example.development.rb @@ -84,13 +84,6 @@ # https://github.com/puma/puma/blob/master/5.0-Upgrade.md#lower-latency-better-throughput wait_for_less_busy_worker ENV.fetch('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 -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 "/home/git/gitlab/lib/gitlab/puma_logging/json_formatter" diff --git a/config/puma.rb.example b/config/puma.rb.example index ac3adc1eeec142..07a6f6a2501533 100644 --- a/config/puma.rb.example +++ b/config/puma.rb.example @@ -73,13 +73,6 @@ worker_timeout 60 # https://github.com/puma/puma/blob/master/5.0-Upgrade.md#lower-latency-better-throughput wait_for_less_busy_worker ENV.fetch('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 -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 "/home/git/gitlab/lib/gitlab/puma_logging/json_formatter" -- GitLab