Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump puma from 6.5.0 to 6.6.0 #716

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Jan 29, 2025

Bumps puma from 6.5.0 to 6.6.0.

Release notes

Sourced from puma's releases.

6.6.0 - Return to Forever

image

Some stuff for JRuby users (SIGUSR2 trap), reforkers (see below), and a few debug/logging/observability related goodies.

  • Features

    • Option to turn off SIGUSR2 trapping (#3570, #3567)
    • Shorten ThreadPool trimmer and reaper thread names (#3383)
    • Add after_refork hook (#3386)
    • Add busy threads stat (#3517)
    • Add a debug log before running each type of hook (#3375)
    • Allow alternative schemes in Binder (#3348, #3302)
    • Avoid spawning Threadpool#trim thread if pool size is fixed (#3384)
  • Bugfixes

    • Change HttpParserError to be subclass of StandardError (#3590, #3552)
    • added test cases
    • fix update phased restart symlink folder
  • Performance

    • Only ping worker 0 during phased restart if using fork worker (#3568)
  • Refactor

    • Fix multi-delimiter split to get status app token (#3505)
    • Change ping to use const (#3595)
    • Fixup use of Puma::Const::PipeRequest constants (#3565)
    • Update DSL hook processing logic to be consistent (#3376)
Changelog

Sourced from puma's changelog.

6.6.0 / 2025-01-29

  • Features

    • Option to turn off SIGUSR2 trapping (#3570, #3567)
    • Shorten ThreadPool trimmer and reaper thread names (#3383)
    • Add after_refork hook (#3386)
    • Add busy threads stat (#3517)
    • Add a debug log before running each type of hook (#3375)
    • Allow alternative schemes in Binder (#3348, #3302)
    • Avoid spawning Threadpool#trim thread if pool size is fixed (#3384)
  • Bugfixes

    • Change HttpParserError to be subclass of StandardError (#3590, #3552)
    • added test cases
    • fix update phased restart symlink folder
  • Performance

    • Only ping worker 0 during phased restart if using fork worker (#3568)
  • Refactor

    • Fix multi-delimiter split to get status app token (#3505)
    • Change ping to use const (#3595)
    • Fixup use of Puma::Const::PipeRequest constants (#3565)
    • Update DSL hook processing logic to be consistent (#3376)
Commits

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Bumps [puma](https://github.com/puma/puma) from 6.5.0 to 6.6.0.
- [Release notes](https://github.com/puma/puma/releases)
- [Changelog](https://github.com/puma/puma/blob/master/History.md)
- [Commits](puma/puma@v6.5.0...v6.6.0)

---
updated-dependencies:
- dependency-name: puma
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
@dependabot dependabot bot added dependencies ruby Pull requests that update Ruby code labels Jan 29, 2025
Copy link

Copy link

gem compare puma 6.5.0 6.6.0

Compared versions: ["6.5.0", "6.6.0"]
  DIFFERENT date:
    6.5.0: 2024-11-22 00:00:00 UTC
    6.6.0: 2025-01-28 00:00:00 UTC
  DIFFERENT require_paths:
    6.5.0: ["/opt/hostedtoolcache/Ruby/3.4.1/x64/lib/ruby/gems/3.4.0/extensions/x86_64-linux/3.4.0/puma-6.5.0", "lib"]
    6.6.0: ["/opt/hostedtoolcache/Ruby/3.4.1/x64/lib/ruby/gems/3.4.0/extensions/x86_64-linux/3.4.0/puma-6.6.0", "lib"]
  DIFFERENT rubygems_version:
    6.5.0: 3.5.22
    6.6.0: 3.6.3
  DIFFERENT version:
    6.5.0: 6.5.0
    6.6.0: 6.6.0
  DIFFERENT files:
    6.5.0->6.6.0:
      * Changed:
            History.md +43/-2
            README.md +9/-1
            docs/fork_worker.md +7/-1
            docs/java_options.md +6/-0
            docs/plugins.md +4/-0
            docs/stats.md +6/-2
            ext/puma_http11/org/jruby/puma/Http11.java +1/-1
            ext/puma_http11/puma_http11.c +1/-1
            lib/puma/app/status.rb +1/-1
            lib/puma/binder.rb +7/-0
            lib/puma/cluster.rb +12/-8
            lib/puma/cluster/worker.rb +9/-6
            lib/puma/cluster/worker_handle.rb +1/-1
            lib/puma/configuration.rb +2/-0
            lib/puma/const.rb +10/-9
            lib/puma/dsl.rb +30/-10
            lib/puma/launcher.rb +14/-5
            lib/puma/runner.rb +4/-1
            lib/puma/sd_notify.rb +1/-4
            lib/puma/server.rb +9/-5
            lib/puma/thread_pool.rb +4/-3

Copy link

gem compare --diff puma 6.5.0 6.6.0

Compared versions: ["6.5.0", "6.6.0"]
  DIFFERENT files:
    6.5.0->6.6.0:
      * Changed:
        History.md
                --- /tmp/d20250129-2293-e9yp0o/puma-6.5.0/History.md	2025-01-29 03:48:04.605774110 +0000
                +++ /tmp/d20250129-2293-e9yp0o/puma-6.6.0/History.md	2025-01-29 03:48:04.620774006 +0000
                @@ -0,0 +1,25 @@
                +## 6.6.0 / 2025-01-29
                +
                +* Features
                +  * Option to turn off SIGUSR2 trapping ([#3570], [#3567])
                +  * Shorten `ThreadPool` trimmer and reaper thread names ([#3383])
                +  * Add after_refork hook ([#3386])
                +  * Add busy threads stat ([#3517])
                +  * Add a debug log before running each type of hook ([#3375])
                +  * Allow alternative schemes in Binder ([#3348], [#3302])
                +  * Avoid spawning `Threadpool#trim` thread if pool size is fixed ([#3384])
                +
                +* Bugfixes
                +  * Change `HttpParserError` to be subclass of `StandardError` ([#3590], [#3552])
                +  * added test cases
                +  * fix update phased restart symlink folder
                +
                +* Performance
                +  * Only ping worker 0 during phased restart if using fork worker ([#3568])
                +
                +* Refactor
                +  * Fix multi-delimiter split to get status app token ([#3505])
                +  * Change ping to use const ([#3595])
                +  * Fixup use of Puma::Const::PipeRequest constants ([#3565])
                +  * Update DSL hook processing logic to be consistent ([#3376])
                +
                @@ -2127,0 +2153,16 @@
                +[#3570]:https://github.com/puma/puma/pull/3570     "PR by @mohamedhafez, merged 2024-12-30"
                +[#3567]:https://github.com/puma/puma/issues/3567   "Issue by @mohamedhafez, closed 2024-12-30"
                +[#3383]:https://github.com/puma/puma/pull/3383     "PR by @joshuay03, merged 2024-11-29"
                +[#3386]:https://github.com/puma/puma/pull/3386     "PR by @Drakula2k, merged 2024-11-27"
                +[#3517]:https://github.com/puma/puma/pull/3517     "PR by @jjb, merged 2024-11-26"
                +[#3375]:https://github.com/puma/puma/pull/3375     "PR by @joshuay03, merged 2024-11-23"
                +[#3348]:https://github.com/puma/puma/pull/3348     "PR by @tomurb, merged 2024-11-23"
                +[#3302]:https://github.com/puma/puma/issues/3302   "Issue by @benburkert, closed 2024-11-23"
                +[#3384]:https://github.com/puma/puma/pull/3384     "PR by @joshuay03, merged 2024-11-23"
                +[#3590]:https://github.com/puma/puma/pull/3590     "PR by @MSP-Greg, merged 2025-01-01"
                +[#3552]:https://github.com/puma/puma/issues/3552   "Issue by @utay, closed 2025-01-01"
                +[#3568]:https://github.com/puma/puma/pull/3568     "PR by @joshuay03, merged 2024-12-11"
                +[#3505]:https://github.com/puma/puma/pull/3505     "PR by @AnthonyClark, merged 2025-01-27"
                +[#3595]:https://github.com/puma/puma/pull/3595     "PR by @nateberkopec, merged 2025-01-07"
                +[#3565]:https://github.com/puma/puma/pull/3565     "PR by @MSP-Greg, merged 2024-11-28"
                +[#3376]:https://github.com/puma/puma/pull/3376     "PR by @joshuay03, merged 2024-11-23"
                @@ -2712 +2753 @@
                -[#840]:https://github.com/puma/puma/issues/840     "Issue by @maxkwallace, closed 2016-04-07"
                +[#840]:https://github.com/puma/puma/issues/840     "Issue by @marisawallace, closed 2016-04-07"
                @@ -2719 +2760 @@
                -[#956]:https://github.com/puma/puma/pull/956       "PR by @maxkwallace, merged 2016-04-12"
                +[#956]:https://github.com/puma/puma/pull/956       "PR by @marisawallace, merged 2016-04-12"
        README.md
                --- /tmp/d20250129-2293-e9yp0o/puma-6.5.0/README.md	2025-01-29 03:48:04.605774110 +0000
                +++ /tmp/d20250129-2293-e9yp0o/puma-6.6.0/README.md	2025-01-29 03:48:04.621773999 +0000
                @@ -162 +162 @@
                -In addition, there is an `on_refork` hook which is used only in [`fork_worker` mode](docs/fork_worker.md),
                +In addition, there is an `on_refork` and `after_refork` hooks which are used only in [`fork_worker` mode](docs/fork_worker.md),
                @@ -171,0 +172,7 @@
                +```ruby
                +after_refork do
                +  # Used only when fork_worker mode is enabled. Add code to run inside the Puma worker 0
                +  # child process after it forks a grandchild worker.
                +end
                +```
                +
                @@ -188,0 +196 @@
                +4. Use `after_refork` to restart any background threads on the parent.
        docs/fork_worker.md
                --- /tmp/d20250129-2293-e9yp0o/puma-6.5.0/docs/fork_worker.md	2025-01-29 03:48:04.606774103 +0000
                +++ /tmp/d20250129-2293-e9yp0o/puma-6.6.0/docs/fork_worker.md	2025-01-29 03:48:04.622773992 +0000
                @@ -27 +27,7 @@
                -- `fork_worker` introduces a new `on_refork` configuration hook. If you were using the `before_fork` hook previously, we generally recommend to copy its logic to `on_refork`. Note that `fork_worker` triggers the `before_fork` configuration hook *only* when initially forking the master process to worker 0, and triggers the `on_refork` hook on all subsequent forks from worker 0 to additional workers.
                +- `fork_worker` introduces new `on_refork` and `after_refork` configuration hooks. Note the following:
                +    - When initially forking the parent process to the worker 0 child, `before_fork` will trigger on the parent process and `on_worker_boot` will trigger on the worker 0 child as normal.
                +    - When forking the worker 0 child to grandchild workers, `on_refork` and `after_refork` will trigger on the worker 0 child, and `on_worker_boot` will trigger on each grandchild worker.
                +    - For clarity, `before_fork` does not trigger on worker 0, and `after_refork` does not trigger on the grandchild.
                +- As a general migration guide:
                +    - Copy any logic within your existing `before_fork` hook to the `on_refork` hook.
                +    - Consider to copy logic from your `on_worker_boot` hook to the `after_refork` hook, if it is needed to reset the state of worker 0 after it forks.
        docs/java_options.md
                --- /tmp/d20250129-2293-e9yp0o/puma-6.5.0/docs/java_options.md	2025-01-29 03:48:04.607774096 +0000
                +++ /tmp/d20250129-2293-e9yp0o/puma-6.6.0/docs/java_options.md	2025-01-29 03:48:04.622773992 +0000
                @@ -14,0 +15 @@
                +| PUMA_SKIP_SIGUSR2            |   nil         | n/a                      |
                @@ -48,0 +50,5 @@
                +### Java Flight Recorder Compatibility
                +
                +Unfortunately Java Flight Recorder uses `SIGUSR2` internally. If you wish to 
                +use JFR, turn off Puma's trapping of `SIGUSR2` by setting the environment variable
                +`PUMA_SKIP_SIGUSR2` to any value.
        docs/plugins.md
                --- /tmp/d20250129-2293-e9yp0o/puma-6.5.0/docs/plugins.md	2025-01-29 03:48:04.608774089 +0000
                +++ /tmp/d20250129-2293-e9yp0o/puma-6.6.0/docs/plugins.md	2025-01-29 03:48:04.623773985 +0000
                @@ -38,0 +39,4 @@
                +
                +## Binder hooks
                +
                +There's `Puma::Binder#before_parse` method that allows to add proc to run before the body of `Puma::Binder#parse`. Example of usage can be found in [that repository](https://github.com/anchordotdev/puma-acme/blob/v0.1.3/lib/puma/acme/plugin.rb#L97-L118) (`before_parse_hook` could be renamed `before_parse`, making monkey patching of [binder.rb](https://github.com/anchordotdev/puma-acme/blob/v0.1.3/lib/puma/acme/binder.rb) is unnecessary).
                \ No newline at end of file
        docs/stats.md
                --- /tmp/d20250129-2293-e9yp0o/puma-6.5.0/docs/stats.md	2025-01-29 03:48:04.609774082 +0000
                +++ /tmp/d20250129-2293-e9yp0o/puma-6.6.0/docs/stats.md	2025-01-29 03:48:04.624773979 +0000
                @@ -58 +58 @@
                -* backlog: requests that are waiting for an available thread to be available. if this is above 0, you need more capacity [always true?]
                +* backlog: requests that are waiting for an available thread to be available. if this is frequently above 0, you need more capacity.
                @@ -61 +61,5 @@
                -* pool_capacity: the number of requests that the server is capable of taking right now. For example, if the number is 5, then it means there are 5 threads sitting idle ready to take a request. If one request comes in, then the value would be 4 until it finishes processing. If the minimum threads allowed is zero, this number will still have a maximum value of the maximum threads allowed.
                +* busy_threads: `running` - `how many threads are waiting to receive work` + `how many requests are waiting for a thread to pick them up`.
                +  this is a "wholistic" stat reflecting the overall current state of work to be done and the capacity to do it.
                +* pool_capacity: `how many threads are waiting to receive work` + `max_threads` - `running`. In a typical configuration where `min_threads`
                +  and `max_threads` are configured to the same number, this is simply `how many threads are waiting to receive work`. This number exists only as a stat
                +  and is not used for any internal decisions, unlike `busy_theads`, which is usually a more useful stat.
        ext/puma_http11/org/jruby/puma/Http11.java
                --- /tmp/d20250129-2293-e9yp0o/puma-6.5.0/ext/puma_http11/org/jruby/puma/Http11.java	2025-01-29 03:48:04.611774069 +0000
                +++ /tmp/d20250129-2293-e9yp0o/puma-6.6.0/ext/puma_http11/org/jruby/puma/Http11.java	2025-01-29 03:48:04.626773965 +0000
                @@ -80 +80 @@
                -        mPuma.defineClassUnder("HttpParserError",runtime.getClass("IOError"),runtime.getClass("IOError").getAllocator());
                +        mPuma.defineClassUnder("HttpParserError",runtime.getClass("StandardError"),runtime.getClass("StandardError").getAllocator());
        ext/puma_http11/puma_http11.c
                --- /tmp/d20250129-2293-e9yp0o/puma-6.5.0/ext/puma_http11/puma_http11.c	2025-01-29 03:48:04.611774069 +0000
                +++ /tmp/d20250129-2293-e9yp0o/puma-6.6.0/ext/puma_http11/puma_http11.c	2025-01-29 03:48:04.627773958 +0000
                @@ -478 +478 @@
                -  eHttpParserError = rb_define_class_under(mPuma, "HttpParserError", rb_eIOError);
                +  eHttpParserError = rb_define_class_under(mPuma, "HttpParserError", rb_eStandardError);
        lib/puma/app/status.rb
                --- /tmp/d20250129-2293-e9yp0o/puma-6.5.0/lib/puma/app/status.rb	2025-01-29 03:48:04.612774062 +0000
                +++ /tmp/d20250129-2293-e9yp0o/puma-6.6.0/lib/puma/app/status.rb	2025-01-29 03:48:04.627773958 +0000
                @@ -83 +83 @@
                -        env['QUERY_STRING'].to_s.split('&;').include? "token=#{@auth_token}"
                +        env['QUERY_STRING'].to_s.split(/[&;]/).include? "token=#{@auth_token}"
        lib/puma/binder.rb
                --- /tmp/d20250129-2293-e9yp0o/puma-6.5.0/lib/puma/binder.rb	2025-01-29 03:48:04.612774062 +0000
                +++ /tmp/d20250129-2293-e9yp0o/puma-6.6.0/lib/puma/binder.rb	2025-01-29 03:48:04.628773951 +0000
                @@ -144,0 +145,6 @@
                +    def before_parse(&block)
                +      @before_parse ||= []
                +      @before_parse << block if block
                +      @before_parse
                +    end
                +
                @@ -145,0 +152 @@
                +      before_parse.each(&:call)
        lib/puma/cluster.rb
                --- /tmp/d20250129-2293-e9yp0o/puma-6.5.0/lib/puma/cluster.rb	2025-01-29 03:48:04.613774055 +0000
                +++ /tmp/d20250129-2293-e9yp0o/puma-6.6.0/lib/puma/cluster.rb	2025-01-29 03:48:04.628773951 +0000
                @@ -89,0 +90,4 @@
                +
                +        if worker_at(0).phase > 0
                +          @fork_writer << "-2\n"
                +        end
                @@ -459 +463 @@
                -              if req == Puma::Const::PipeRequest::WAKEUP
                +              if req == PIPE_WAKEUP
                @@ -467 +471 @@
                -              if req == Puma::Const::PipeRequest::BOOT || req == Puma::Const::PipeRequest::FORK
                +              if req == PIPE_BOOT || req == PIPE_FORK
                @@ -475 +479 @@
                -                when Puma::Const::PipeRequest::BOOT
                +                when PIPE_BOOT
                @@ -480 +484 @@
                -                when Puma::Const::PipeRequest::EXTERNAL_TERM
                +                when PIPE_EXTERNAL_TERM
                @@ -483 +487 @@
                -                when Puma::Const::PipeRequest::TERM
                +                when PIPE_TERM
                @@ -485 +489 @@
                -                when Puma::Const::PipeRequest::PING
                +                when PIPE_PING
                @@ -490 +494 @@
                -                  if in_phased_restart && workers_not_booted.positive? && w0 = worker_at(0)
                +                  if in_phased_restart && @options[:fork_worker] && workers_not_booted.positive? && w0 = worker_at(0)
                @@ -500 +504 @@
                -                when Puma::Const::PipeRequest::IDLE
                +                when PIPE_IDLE
        lib/puma/cluster/worker.rb
                --- /tmp/d20250129-2293-e9yp0o/puma-6.5.0/lib/puma/cluster/worker.rb	2025-01-29 03:48:04.613774055 +0000
                +++ /tmp/d20250129-2293-e9yp0o/puma-6.6.0/lib/puma/cluster/worker.rb	2025-01-29 03:48:04.628773951 +0000
                @@ -90,0 +91,2 @@
                +              elsif idx == -2 # refork cycle is done
                +                @config.run_hooks(:after_refork, nil, @log_writer, @hook_data)
                @@ -95 +97 @@
                -                @worker_write << "#{Puma::Const::PipeRequest::FORK}#{pid}:#{idx}\n" rescue nil
                +                @worker_write << "#{PIPE_FORK}#{pid}:#{idx}\n" rescue nil
                @@ -102 +104 @@
                -          @worker_write << "#{Puma::Const::PipeRequest::EXTERNAL_TERM}#{Process.pid}\n" rescue nil
                +          @worker_write << "#{PIPE_EXTERNAL_TERM}#{Process.pid}\n" rescue nil
                @@ -109 +111 @@
                -          @worker_write << "#{Puma::Const::PipeRequest::BOOT}#{Process.pid}:#{index}\n"
                +          @worker_write << "#{PIPE_BOOT}#{Process.pid}:#{index}\n"
                @@ -125 +127 @@
                -            base_payload = "p#{Process.pid}"
                +            base_payload = "#{PIPE_PING}#{Process.pid}"
                @@ -134 +136,2 @@
                -                payload = %Q!#{base_payload}{ "backlog":#{b}, "running":#{r}, "pool_capacity":#{t}, "max_threads":#{m}, "requests_count":#{rc} }\n!
                +                bt = server.busy_threads || 0
                +                payload = %Q!#{base_payload}{ "backlog":#{b}, "running":#{r}, "pool_capacity":#{t}, "max_threads":#{m}, "requests_count":#{rc}, "busy_threads":#{bt} }\n!
                @@ -150 +153 @@
                -        @worker_write << "#{Puma::Const::PipeRequest::TERM}#{Process.pid}\n" rescue nil
                +        @worker_write << "#{PIPE_TERM}#{Process.pid}\n" rescue nil
        lib/puma/cluster/worker_handle.rb
                --- /tmp/d20250129-2293-e9yp0o/puma-6.5.0/lib/puma/cluster/worker_handle.rb	2025-01-29 03:48:04.613774055 +0000
                +++ /tmp/d20250129-2293-e9yp0o/puma-6.6.0/lib/puma/cluster/worker_handle.rb	2025-01-29 03:48:04.629773944 +0000
                @@ -54 +54 @@
                -      STATUS_PATTERN = /{ "backlog":(?<backlog>\d*), "running":(?<running>\d*), "pool_capacity":(?<pool_capacity>\d*), "max_threads":(?<max_threads>\d*), "requests_count":(?<requests_count>\d*) }/
                +      STATUS_PATTERN = /{ "backlog":(?<backlog>\d*), "running":(?<running>\d*), "pool_capacity":(?<pool_capacity>\d*), "max_threads":(?<max_threads>\d*), "requests_count":(?<requests_count>\d*), "busy_threads":(?<busy_threads>\d*) }/
        lib/puma/configuration.rb
                --- /tmp/d20250129-2293-e9yp0o/puma-6.5.0/lib/puma/configuration.rb	2025-01-29 03:48:04.613774055 +0000
                +++ /tmp/d20250129-2293-e9yp0o/puma-6.6.0/lib/puma/configuration.rb	2025-01-29 03:48:04.629773944 +0000
                @@ -320,0 +321,2 @@
                +      log_writer.debug "Running #{key} hooks"
                +
        lib/puma/const.rb
                --- /tmp/d20250129-2293-e9yp0o/puma-6.5.0/lib/puma/const.rb	2025-01-29 03:48:04.614774048 +0000
                +++ /tmp/d20250129-2293-e9yp0o/puma-6.6.0/lib/puma/const.rb	2025-01-29 03:48:04.629773944 +0000
                @@ -103,2 +103,2 @@
                -    PUMA_VERSION = VERSION = "6.5.0"
                -    CODE_NAME = "Sky's Version"
                +    PUMA_VERSION = VERSION = "6.6.0"
                +    CODE_NAME = "Return to Forever"
                @@ -296,0 +297 @@
                +    # All constants are prefixed with `PIPE_` to avoid name collisions.
                @@ -298,7 +299,7 @@
                -      WAKEUP = "!"
                -      BOOT = "b"
                -      FORK = "f"
                -      EXTERNAL_TERM = "e"
                -      TERM = "t"
                -      PING = "p"
                -      IDLE = "i"
                +      PIPE_WAKEUP = "!"
                +      PIPE_BOOT = "b"
                +      PIPE_FORK = "f"
                +      PIPE_EXTERNAL_TERM = "e"
                +      PIPE_TERM = "t"
                +      PIPE_PING = "p"
                +      PIPE_IDLE = "i"
        lib/puma/dsl.rb
                --- /tmp/d20250129-2293-e9yp0o/puma-6.5.0/lib/puma/dsl.rb	2025-01-29 03:48:04.614774048 +0000
                +++ /tmp/d20250129-2293-e9yp0o/puma-6.6.0/lib/puma/dsl.rb	2025-01-29 03:48:04.630773937 +0000
                @@ -49,0 +50 @@
                +  #     | after_refork       | :after_refork           | inside              |
                @@ -441,2 +442 @@
                -      @options[:on_restart] ||= []
                -      @options[:on_restart] << block
                +      process_hook :on_restart, nil, block, 'on_restart'
                @@ -734,2 +734 @@
                -      @options[:before_fork] ||= []
                -      @options[:before_fork] << block
                +      process_hook :before_fork, nil, block, 'before_fork'
                @@ -857,0 +857,2 @@
                +      warn_if_in_single_mode('on_refork')
                +
                @@ -860,0 +862,21 @@
                +    # When `fork_worker` is enabled, code to run in Worker 0
                +    # after all other workers are re-forked from this process,
                +    # after the server has temporarily stopped serving requests
                +    # (once per complete refork cycle).
                +    #
                +    # This can be used to re-open any connections to remote servers
                +    # (database, Redis, ...) that were closed via on_refork.
                +    #
                +    # This can be called multiple times to add several hooks.
                +    #
                +    # @note Cluster mode with `fork_worker` enabled only.
                +    #
                +    # @example
                +    #   after_refork do
                +    #     puts 'After refork...'
                +    #   end
                +    #
                +    def after_refork(key = nil, &block)
                +      process_hook :after_refork, key, block, 'after_refork'
                +    end
                +
                @@ -879,2 +901 @@
                -      @options[:before_thread_start] ||= []
                -      @options[:before_thread_start] << block
                +      process_hook :before_thread_start, nil, block, 'on_thread_start'
                @@ -904,2 +925 @@
                -      @options[:before_thread_exit] ||= []
                -      @options[:before_thread_exit] << block
                +      process_hook :before_thread_exit, nil, block, 'on_thread_exit'
                @@ -1418,2 +1438,2 @@
                -          "but Puma is not configured to run in cluster mode (worker count > 0 ), " \
                -          "so your `#{hook_name}` block did not run"
                +          "but Puma is not configured to run in cluster mode (worker count > 0), " \
                +          "so your `#{hook_name}` block will not run."
        lib/puma/launcher.rb
                --- /tmp/d20250129-2293-e9yp0o/puma-6.5.0/lib/puma/launcher.rb	2025-01-29 03:48:04.615774041 +0000
                +++ /tmp/d20250129-2293-e9yp0o/puma-6.6.0/lib/puma/launcher.rb	2025-01-29 03:48:04.630773937 +0000
                @@ -169,0 +170,7 @@
                +
                +      if @options.file_options[:tag].nil?
                +        dir = File.realdirpath(@restart_dir)
                +        @options[:tag] = File.basename(dir)
                +        set_process_title
                +      end
                +
                @@ -415,3 +422,7 @@
                -      begin
                -        Signal.trap "SIGUSR2" do
                -          restart
                +      unless ENV["PUMA_SKIP_SIGUSR2"]
                +        begin
                +          Signal.trap "SIGUSR2" do
                +            restart
                +          end
                +        rescue Exception
                +          log "*** SIGUSR2 not implemented, signal based restart unavailable!"
                @@ -419,2 +429,0 @@
                -      rescue Exception
                -        log "*** SIGUSR2 not implemented, signal based restart unavailable!"
        lib/puma/runner.rb
                --- /tmp/d20250129-2293-e9yp0o/puma-6.5.0/lib/puma/runner.rb	2025-01-29 03:48:04.617774027 +0000
                +++ /tmp/d20250129-2293-e9yp0o/puma-6.6.0/lib/puma/runner.rb	2025-01-29 03:48:04.633773916 +0000
                @@ -10,0 +11,3 @@
                +
                +    include ::Puma::Const::PipeRequest
                +
                @@ -30 +33 @@
                -      @wakeup.write Puma::Const::PipeRequest::WAKEUP unless @wakeup.closed?
                +      @wakeup.write PIPE_WAKEUP unless @wakeup.closed?
        lib/puma/sd_notify.rb
                --- /tmp/d20250129-2293-e9yp0o/puma-6.5.0/lib/puma/sd_notify.rb	2025-01-29 03:48:04.618774020 +0000
                +++ /tmp/d20250129-2293-e9yp0o/puma-6.6.0/lib/puma/sd_notify.rb	2025-01-29 03:48:04.633773916 +0000
                @@ -140,4 +140 @@
                -        Addrinfo.unix(sock, :DGRAM).connect do |s|
                -          s.close_on_exec = true
                -          s.write(state)
                -        end
                +        Addrinfo.unix(sock, :DGRAM).connect { |s| s.write state }
        lib/puma/server.rb
                --- /tmp/d20250129-2293-e9yp0o/puma-6.5.0/lib/puma/server.rb	2025-01-29 03:48:04.618774020 +0000
                +++ /tmp/d20250129-2293-e9yp0o/puma-6.6.0/lib/puma/server.rb	2025-01-29 03:48:04.633773916 +0000
                @@ -235,0 +236,5 @@
                +    # @!attribute [r] busy_threads
                +    def busy_threads
                +      @thread_pool&.busy_threads
                +    end
                +
                @@ -256 +260,0 @@
                -
                @@ -258 +262 @@
                -      @thread_pool.auto_trim! if options[:auto_trim_time]
                +      @thread_pool.auto_trim! if @min_threads != @max_threads && options[:auto_trim_time]
                @@ -343 +347 @@
                -                  @worker_write << "#{PipeRequest::IDLE}#{Process.pid}\n" rescue nil
                +                  @worker_write << "#{PipeRequest::PIPE_IDLE}#{Process.pid}\n" rescue nil
                @@ -356 +360 @@
                -              @worker_write << "#{PipeRequest::IDLE}#{Process.pid}\n" rescue nil
                +              @worker_write << "#{PipeRequest::PIPE_IDLE}#{Process.pid}\n" rescue nil
                @@ -649 +653 @@
                -    STAT_METHODS = [:backlog, :running, :pool_capacity, :max_threads, :requests_count].freeze
                +    STAT_METHODS = [:backlog, :running, :pool_capacity, :max_threads, :requests_count, :busy_threads].freeze
        lib/puma/thread_pool.rb
                --- /tmp/d20250129-2293-e9yp0o/puma-6.5.0/lib/puma/thread_pool.rb	2025-01-29 03:48:04.618774020 +0000
                +++ /tmp/d20250129-2293-e9yp0o/puma-6.6.0/lib/puma/thread_pool.rb	2025-01-29 03:48:04.634773910 +0000
                @@ -94 +94,2 @@
                -          pool_capacity: @waiting + (@max - @spawned)
                +          pool_capacity: @waiting + (@max - @spawned),
                +          busy_threads: @spawned - @waiting + @todo.size
                @@ -372 +373 @@
                -      @auto_trim = Automaton.new(self, timeout, "#{@name} threadpool trimmer", :trim)
                +      @auto_trim = Automaton.new(self, timeout, "#{@name} tp trim", :trim)
                @@ -377 +378 @@
                -      @reaper = Automaton.new(self, timeout, "#{@name} threadpool reaper", :reap)
                +      @reaper = Automaton.new(self, timeout, "#{@name} tp reap", :reap)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies ruby Pull requests that update Ruby code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants