puma 6.4.0 → 6.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +235 -18
  3. data/README.md +87 -26
  4. data/docs/fork_worker.md +11 -1
  5. data/docs/java_options.md +54 -0
  6. data/docs/kubernetes.md +1 -1
  7. data/docs/plugins.md +4 -0
  8. data/docs/restart.md +1 -0
  9. data/docs/signals.md +2 -2
  10. data/docs/stats.md +8 -3
  11. data/docs/systemd.md +13 -6
  12. data/ext/puma_http11/extconf.rb +21 -14
  13. data/ext/puma_http11/mini_ssl.c +16 -2
  14. data/ext/puma_http11/org/jruby/puma/Http11.java +31 -8
  15. data/ext/puma_http11/org/jruby/puma/MiniSSL.java +2 -1
  16. data/ext/puma_http11/puma_http11.c +4 -1
  17. data/lib/puma/app/status.rb +1 -1
  18. data/lib/puma/binder.rb +12 -4
  19. data/lib/puma/cli.rb +9 -5
  20. data/lib/puma/client.rb +104 -16
  21. data/lib/puma/cluster/worker.rb +9 -6
  22. data/lib/puma/cluster/worker_handle.rb +4 -5
  23. data/lib/puma/cluster.rb +112 -27
  24. data/lib/puma/configuration.rb +37 -21
  25. data/lib/puma/const.rb +22 -3
  26. data/lib/puma/control_cli.rb +4 -4
  27. data/lib/puma/detect.rb +3 -4
  28. data/lib/puma/dsl.rb +303 -58
  29. data/lib/puma/error_logger.rb +4 -4
  30. data/lib/puma/jruby_restart.rb +0 -16
  31. data/lib/puma/launcher.rb +21 -8
  32. data/lib/puma/log_writer.rb +9 -9
  33. data/lib/puma/minissl/context_builder.rb +3 -0
  34. data/lib/puma/minissl.rb +6 -0
  35. data/lib/puma/null_io.rb +42 -2
  36. data/lib/puma/request.rb +35 -14
  37. data/lib/puma/runner.rb +10 -3
  38. data/lib/puma/sd_notify.rb +1 -4
  39. data/lib/puma/server.rb +53 -21
  40. data/lib/puma/single.rb +1 -1
  41. data/lib/puma/state_file.rb +2 -2
  42. data/lib/puma/thread_pool.rb +14 -2
  43. data/lib/puma/util.rb +1 -1
  44. data/lib/rack/handler/puma.rb +8 -5
  45. data/tools/Dockerfile +5 -3
  46. metadata +10 -12
@@ -85,6 +85,18 @@ module Puma
85
85
  end
86
86
  end
87
87
 
88
+ # generate stats hash so as not to perform multiple locks
89
+ # @return [Hash] hash containing stat info from ThreadPool
90
+ def stats
91
+ with_mutex do
92
+ { backlog: @todo.size,
93
+ running: @spawned,
94
+ pool_capacity: @waiting + (@max - @spawned),
95
+ busy_threads: @spawned - @waiting + @todo.size
96
+ }
97
+ end
98
+ end
99
+
88
100
  # How many objects have yet to be processed by the pool?
89
101
  #
90
102
  def backlog
@@ -358,12 +370,12 @@ module Puma
358
370
  end
359
371
 
360
372
  def auto_trim!(timeout=@auto_trim_time)
361
- @auto_trim = Automaton.new(self, timeout, "#{@name} threadpool trimmer", :trim)
373
+ @auto_trim = Automaton.new(self, timeout, "#{@name} tp trim", :trim)
362
374
  @auto_trim.start!
363
375
  end
364
376
 
365
377
  def auto_reap!(timeout=@reaping_time)
366
- @reaper = Automaton.new(self, timeout, "#{@name} threadpool reaper", :reap)
378
+ @reaper = Automaton.new(self, timeout, "#{@name} tp reap", :reap)
367
379
  @reaper.start!
368
380
  end
369
381
 
data/lib/puma/util.rb CHANGED
@@ -11,7 +11,7 @@ module Puma
11
11
  end
12
12
 
13
13
  # An instance method on Thread has been provided to address https://bugs.ruby-lang.org/issues/13632,
14
- # which currently effects some older versions of Ruby: 2.2.7 2.2.8 2.2.9 2.2.10 2.3.4 2.4.1
14
+ # which currently affects some older versions of Ruby: 2.2.7 2.2.8 2.2.9 2.2.10 2.3.4 2.4.1
15
15
  # Additional context: https://github.com/puma/puma/pull/1345
16
16
  def purge_interrupt_queue
17
17
  Thread.current.purge_interrupt_queue if Thread.current.respond_to? :purge_interrupt_queue
@@ -1,7 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # This module is used as an 'include' file in code at bottom of file
4
3
  module Puma
4
+
5
+ # This module is used as an 'include' file in code at bottom of file. It loads
6
+ # into either `Rackup::Handler::Puma` or `Rack::Handler::Puma`.
7
+
5
8
  module RackHandler
6
9
  DEFAULT_OPTIONS = {
7
10
  :Verbose => false,
@@ -93,9 +96,9 @@ module Puma
93
96
  def set_host_port_to_config(host, port, config)
94
97
  config.clear_binds! if host || port
95
98
 
96
- if host && (host[0,1] == '.' || host[0,1] == '/')
99
+ if host&.start_with? '.', '/', '@'
97
100
  config.bind "unix://#{host}"
98
- elsif host && host =~ /^ssl:\/\//
101
+ elsif host&.start_with? 'ssl://'
99
102
  uri = URI.parse(host)
100
103
  uri.port ||= port || ::Puma::Configuration::DEFAULTS[:tcp_port]
101
104
  config.bind uri.to_s
@@ -115,7 +118,7 @@ module Puma
115
118
  end
116
119
 
117
120
  # rackup was removed in Rack 3, it is now a separate gem
118
- if Object.const_defined? :Rackup
121
+ if Object.const_defined?(:Rackup) && ::Rackup.const_defined?(:Handler)
119
122
  module Rackup
120
123
  module Handler
121
124
  module Puma
@@ -127,7 +130,7 @@ if Object.const_defined? :Rackup
127
130
  end
128
131
  end
129
132
  else
130
- do_register = Object.const_defined?(:Rack) && Rack.release < '3'
133
+ do_register = Object.const_defined?(:Rack) && ::Rack.release < '3'
131
134
  module Rack
132
135
  module Handler
133
136
  module Puma
data/tools/Dockerfile CHANGED
@@ -1,6 +1,8 @@
1
1
  # Use this Dockerfile to create minimal reproductions of issues
2
2
 
3
- FROM ruby:3.1
3
+ FROM ruby:3.2
4
+
5
+ RUN apt-get update && apt-get install -y ragel
4
6
 
5
7
  # throw errors if Gemfile has been modified since Gemfile.lock
6
8
  RUN bundle config --global frozen 1
@@ -8,9 +10,9 @@ RUN bundle config --global frozen 1
8
10
  WORKDIR /usr/src/app
9
11
 
10
12
  COPY . .
11
- RUN gem install bundler
13
+
12
14
  RUN bundle install
13
15
  RUN bundle exec rake compile
14
16
 
15
17
  EXPOSE 9292
16
- CMD bundle exec bin/puma test/rackup/hello.ru
18
+ CMD ["bundle", "exec", "bin/puma", "test/rackup/hello.ru"]
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puma
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.4.0
4
+ version: 6.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Phoenix
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 1980-01-01 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: nio4r
@@ -24,10 +23,11 @@ dependencies:
24
23
  - - "~>"
25
24
  - !ruby/object:Gem::Version
26
25
  version: '2.0'
27
- description: Puma is a simple, fast, threaded, and highly parallel HTTP 1.1 server
28
- for Ruby/Rack applications. Puma is intended for use in both development and production
29
- environments. It's great for highly parallel Ruby implementations such as Rubinius
30
- and JRuby as well as as providing process worker support to support CRuby well.
26
+ description: |
27
+ Puma is a simple, fast, multi-threaded, and highly parallel HTTP 1.1 server
28
+ for Ruby/Rack applications. Puma is intended for use in both development and
29
+ production environments. It's great for highly parallel Ruby implementations such as
30
+ JRuby and TruffleRuby as well as as providing process worker support to support CRuby well.
31
31
  email:
32
32
  - evan@phx.io
33
33
  executables:
@@ -50,6 +50,7 @@ files:
50
50
  - docs/images/puma-connection-flow-no-reactor.png
51
51
  - docs/images/puma-connection-flow.png
52
52
  - docs/images/puma-general-arch.png
53
+ - docs/java_options.md
53
54
  - docs/jungle/README.md
54
55
  - docs/jungle/rc.d/README.md
55
56
  - docs/jungle/rc.d/puma
@@ -130,7 +131,6 @@ metadata:
130
131
  homepage_uri: https://puma.io
131
132
  source_code_uri: https://github.com/puma/puma
132
133
  rubygems_mfa_required: 'true'
133
- post_install_message:
134
134
  rdoc_options: []
135
135
  require_paths:
136
136
  - lib
@@ -145,9 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
145
  - !ruby/object:Gem::Version
146
146
  version: '0'
147
147
  requirements: []
148
- rubygems_version: 3.4.12
149
- signing_key:
148
+ rubygems_version: 3.6.9
150
149
  specification_version: 4
151
- summary: Puma is a simple, fast, threaded, and highly parallel HTTP 1.1 server for
152
- Ruby/Rack applications
150
+ summary: A Ruby/Rack web server built for parallelism.
153
151
  test_files: []