puma 5.6.9-java → 6.6.0-java
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.
- checksums.yaml +4 -4
- data/History.md +465 -18
- data/README.md +152 -42
- data/bin/puma-wild +1 -1
- data/docs/compile_options.md +34 -0
- data/docs/fork_worker.md +12 -4
- data/docs/java_options.md +54 -0
- data/docs/kubernetes.md +12 -0
- data/docs/nginx.md +1 -1
- data/docs/plugins.md +4 -0
- data/docs/restart.md +1 -0
- data/docs/signals.md +2 -2
- data/docs/stats.md +8 -3
- data/docs/systemd.md +13 -7
- data/docs/testing_benchmarks_local_files.md +150 -0
- data/docs/testing_test_rackup_ci_files.md +36 -0
- data/ext/puma_http11/extconf.rb +27 -17
- data/ext/puma_http11/http11_parser.c +1 -1
- data/ext/puma_http11/http11_parser.h +1 -1
- data/ext/puma_http11/http11_parser.java.rl +2 -2
- data/ext/puma_http11/http11_parser.rl +2 -2
- data/ext/puma_http11/http11_parser_common.rl +2 -2
- data/ext/puma_http11/mini_ssl.c +137 -19
- data/ext/puma_http11/org/jruby/puma/Http11.java +31 -10
- data/ext/puma_http11/org/jruby/puma/Http11Parser.java +1 -1
- data/ext/puma_http11/org/jruby/puma/MiniSSL.java +157 -53
- data/ext/puma_http11/puma_http11.c +21 -10
- data/lib/puma/app/status.rb +4 -4
- data/lib/puma/binder.rb +60 -55
- data/lib/puma/cli.rb +22 -20
- data/lib/puma/client.rb +93 -30
- data/lib/puma/cluster/worker.rb +27 -17
- data/lib/puma/cluster/worker_handle.rb +8 -6
- data/lib/puma/cluster.rb +121 -47
- data/lib/puma/commonlogger.rb +21 -14
- data/lib/puma/configuration.rb +101 -65
- data/lib/puma/const.rb +141 -93
- data/lib/puma/control_cli.rb +19 -15
- data/lib/puma/detect.rb +7 -4
- data/lib/puma/dsl.rb +521 -88
- data/lib/puma/error_logger.rb +22 -13
- data/lib/puma/events.rb +6 -126
- data/lib/puma/io_buffer.rb +39 -4
- data/lib/puma/jruby_restart.rb +0 -15
- data/lib/puma/launcher/bundle_pruner.rb +104 -0
- data/lib/puma/launcher.rb +121 -181
- data/lib/puma/log_writer.rb +147 -0
- data/lib/puma/minissl/context_builder.rb +27 -12
- data/lib/puma/minissl.rb +105 -11
- data/lib/puma/null_io.rb +42 -2
- data/lib/puma/plugin/systemd.rb +90 -0
- data/lib/puma/plugin/tmp_restart.rb +1 -1
- data/lib/puma/puma_http11.jar +0 -0
- data/lib/puma/rack/builder.rb +6 -6
- data/lib/puma/rack/urlmap.rb +1 -1
- data/lib/puma/rack_default.rb +19 -4
- data/lib/puma/reactor.rb +19 -10
- data/lib/puma/request.rb +368 -169
- data/lib/puma/runner.rb +65 -22
- data/lib/puma/sd_notify.rb +146 -0
- data/lib/puma/server.rb +161 -102
- data/lib/puma/single.rb +13 -11
- data/lib/puma/state_file.rb +3 -6
- data/lib/puma/thread_pool.rb +71 -21
- data/lib/puma/util.rb +1 -12
- data/lib/puma.rb +9 -10
- data/lib/rack/handler/puma.rb +116 -86
- data/tools/Dockerfile +2 -2
- metadata +17 -12
- data/lib/puma/queue_close.rb +0 -26
- data/lib/puma/systemd.rb +0 -46
- data/lib/rack/version_restriction.rb +0 -15
data/lib/puma/thread_pool.rb
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'thread'
|
4
4
|
|
5
|
+
require_relative 'io_buffer'
|
6
|
+
|
5
7
|
module Puma
|
6
8
|
# Internal Docs for A simple thread pool management object.
|
7
9
|
#
|
@@ -29,7 +31,7 @@ module Puma
|
|
29
31
|
# The block passed is the work that will be performed in each
|
30
32
|
# thread.
|
31
33
|
#
|
32
|
-
def initialize(name,
|
34
|
+
def initialize(name, options = {}, &block)
|
33
35
|
@not_empty = ConditionVariable.new
|
34
36
|
@not_full = ConditionVariable.new
|
35
37
|
@mutex = Mutex.new
|
@@ -40,10 +42,19 @@ module Puma
|
|
40
42
|
@waiting = 0
|
41
43
|
|
42
44
|
@name = name
|
43
|
-
@min = Integer(
|
44
|
-
@max = Integer(
|
45
|
+
@min = Integer(options[:min_threads])
|
46
|
+
@max = Integer(options[:max_threads])
|
47
|
+
# Not an 'exposed' option, options[:pool_shutdown_grace_time] is used in CI
|
48
|
+
# to shorten @shutdown_grace_time from SHUTDOWN_GRACE_TIME. Parallel CI
|
49
|
+
# makes stubbing constants difficult.
|
50
|
+
@shutdown_grace_time = Float(options[:pool_shutdown_grace_time] || SHUTDOWN_GRACE_TIME)
|
45
51
|
@block = block
|
46
|
-
@
|
52
|
+
@out_of_band = options[:out_of_band]
|
53
|
+
@clean_thread_locals = options[:clean_thread_locals]
|
54
|
+
@before_thread_start = options[:before_thread_start]
|
55
|
+
@before_thread_exit = options[:before_thread_exit]
|
56
|
+
@reaping_time = options[:reaping_time]
|
57
|
+
@auto_trim_time = options[:auto_trim_time]
|
47
58
|
|
48
59
|
@shutdown = false
|
49
60
|
|
@@ -62,14 +73,11 @@ module Puma
|
|
62
73
|
end
|
63
74
|
end
|
64
75
|
|
65
|
-
@clean_thread_locals = false
|
66
76
|
@force_shutdown = false
|
67
77
|
@shutdown_mutex = Mutex.new
|
68
78
|
end
|
69
79
|
|
70
80
|
attr_reader :spawned, :trim_requested, :waiting
|
71
|
-
attr_accessor :clean_thread_locals
|
72
|
-
attr_accessor :out_of_band_hook # @version 5.0.0
|
73
81
|
|
74
82
|
def self.clean_thread_locals
|
75
83
|
Thread.current.keys.each do |key| # rubocop: disable Style/HashEachMethods
|
@@ -77,6 +85,18 @@ module Puma
|
|
77
85
|
end
|
78
86
|
end
|
79
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
|
+
|
80
100
|
# How many objects have yet to be processed by the pool?
|
81
101
|
#
|
82
102
|
def backlog
|
@@ -101,6 +121,7 @@ module Puma
|
|
101
121
|
def spawn_thread
|
102
122
|
@spawned += 1
|
103
123
|
|
124
|
+
trigger_before_thread_start_hooks
|
104
125
|
th = Thread.new(@spawned) do |spawned|
|
105
126
|
Puma.set_thread_name '%s tp %03i' % [@name, spawned]
|
106
127
|
todo = @todo
|
@@ -109,8 +130,6 @@ module Puma
|
|
109
130
|
not_empty = @not_empty
|
110
131
|
not_full = @not_full
|
111
132
|
|
112
|
-
extra = @extra.map { |i| i.new }
|
113
|
-
|
114
133
|
while true
|
115
134
|
work = nil
|
116
135
|
|
@@ -121,6 +140,7 @@ module Puma
|
|
121
140
|
@spawned -= 1
|
122
141
|
@workers.delete th
|
123
142
|
not_full.signal
|
143
|
+
trigger_before_thread_exit_hooks
|
124
144
|
Thread.exit
|
125
145
|
end
|
126
146
|
|
@@ -144,7 +164,7 @@ module Puma
|
|
144
164
|
end
|
145
165
|
|
146
166
|
begin
|
147
|
-
@out_of_band_pending = true if block.call(work
|
167
|
+
@out_of_band_pending = true if block.call(work)
|
148
168
|
rescue Exception => e
|
149
169
|
STDERR.puts "Error reached top of thread-pool: #{e.message} (#{e.class})"
|
150
170
|
end
|
@@ -158,14 +178,44 @@ module Puma
|
|
158
178
|
|
159
179
|
private :spawn_thread
|
160
180
|
|
181
|
+
def trigger_before_thread_start_hooks
|
182
|
+
return unless @before_thread_start&.any?
|
183
|
+
|
184
|
+
@before_thread_start.each do |b|
|
185
|
+
begin
|
186
|
+
b.call
|
187
|
+
rescue Exception => e
|
188
|
+
STDERR.puts "WARNING before_thread_start hook failed with exception (#{e.class}) #{e.message}"
|
189
|
+
end
|
190
|
+
end
|
191
|
+
nil
|
192
|
+
end
|
193
|
+
|
194
|
+
private :trigger_before_thread_start_hooks
|
195
|
+
|
196
|
+
def trigger_before_thread_exit_hooks
|
197
|
+
return unless @before_thread_exit&.any?
|
198
|
+
|
199
|
+
@before_thread_exit.each do |b|
|
200
|
+
begin
|
201
|
+
b.call
|
202
|
+
rescue Exception => e
|
203
|
+
STDERR.puts "WARNING before_thread_exit hook failed with exception (#{e.class}) #{e.message}"
|
204
|
+
end
|
205
|
+
end
|
206
|
+
nil
|
207
|
+
end
|
208
|
+
|
209
|
+
private :trigger_before_thread_exit_hooks
|
210
|
+
|
161
211
|
# @version 5.0.0
|
162
212
|
def trigger_out_of_band_hook
|
163
|
-
return false unless
|
213
|
+
return false unless @out_of_band&.any?
|
164
214
|
|
165
215
|
# we execute on idle hook when all threads are free
|
166
216
|
return false unless @spawned == @waiting
|
167
217
|
|
168
|
-
|
218
|
+
@out_of_band.each(&:call)
|
169
219
|
true
|
170
220
|
rescue Exception => e
|
171
221
|
STDERR.puts "Exception calling out_of_band_hook: #{e.message} (#{e.class})"
|
@@ -319,13 +369,13 @@ module Puma
|
|
319
369
|
end
|
320
370
|
end
|
321
371
|
|
322
|
-
def auto_trim!(timeout
|
323
|
-
@auto_trim = Automaton.new(self, timeout, "#{@name}
|
372
|
+
def auto_trim!(timeout=@auto_trim_time)
|
373
|
+
@auto_trim = Automaton.new(self, timeout, "#{@name} tp trim", :trim)
|
324
374
|
@auto_trim.start!
|
325
375
|
end
|
326
376
|
|
327
|
-
def auto_reap!(timeout
|
328
|
-
@reaper = Automaton.new(self, timeout, "#{@name}
|
377
|
+
def auto_reap!(timeout=@reaping_time)
|
378
|
+
@reaper = Automaton.new(self, timeout, "#{@name} tp reap", :reap)
|
329
379
|
@reaper.start!
|
330
380
|
end
|
331
381
|
|
@@ -344,8 +394,8 @@ module Puma
|
|
344
394
|
|
345
395
|
# Tell all threads in the pool to exit and wait for them to finish.
|
346
396
|
# Wait +timeout+ seconds then raise +ForceShutdown+ in remaining threads.
|
347
|
-
# Next, wait an extra +
|
348
|
-
# Finally, wait
|
397
|
+
# Next, wait an extra +@shutdown_grace_time+ seconds then force-kill remaining
|
398
|
+
# threads. Finally, wait 1 second for remaining threads to exit.
|
349
399
|
#
|
350
400
|
def shutdown(timeout=-1)
|
351
401
|
threads = with_mutex do
|
@@ -354,8 +404,8 @@ module Puma
|
|
354
404
|
@not_empty.broadcast
|
355
405
|
@not_full.broadcast
|
356
406
|
|
357
|
-
@auto_trim
|
358
|
-
@reaper
|
407
|
+
@auto_trim&.stop
|
408
|
+
@reaper&.stop
|
359
409
|
# dup workers so that we join them all safely
|
360
410
|
@workers.dup
|
361
411
|
end
|
@@ -382,7 +432,7 @@ module Puma
|
|
382
432
|
t.raise ForceShutdown if t[:with_force_shutdown]
|
383
433
|
end
|
384
434
|
end
|
385
|
-
join.call(
|
435
|
+
join.call(@shutdown_grace_time)
|
386
436
|
|
387
437
|
# If threads are _still_ running, forcefully kill them and wait to finish.
|
388
438
|
threads.each(&:kill)
|
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
|
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
|
@@ -39,17 +39,6 @@ module Puma
|
|
39
39
|
end
|
40
40
|
module_function :unescape, :escape
|
41
41
|
|
42
|
-
# @version 5.0.0
|
43
|
-
def nakayoshi_gc(events)
|
44
|
-
events.log "! Promoting existing objects to old generation..."
|
45
|
-
4.times { GC.start(full_mark: false) }
|
46
|
-
if GC.respond_to?(:compact)
|
47
|
-
events.log "! Compacting..."
|
48
|
-
GC.compact
|
49
|
-
end
|
50
|
-
events.log "! Friendly fork preparation complete."
|
51
|
-
end
|
52
|
-
|
53
42
|
DEFAULT_SEP = /[&;] */n
|
54
43
|
|
55
44
|
# Stolen from Mongrel, with some small modifications:
|
data/lib/puma.rb
CHANGED
@@ -3,23 +3,24 @@
|
|
3
3
|
# Standard libraries
|
4
4
|
require 'socket'
|
5
5
|
require 'tempfile'
|
6
|
-
require 'time'
|
7
|
-
require 'etc'
|
8
6
|
require 'uri'
|
9
7
|
require 'stringio'
|
10
8
|
|
11
9
|
require 'thread'
|
12
10
|
|
13
|
-
#
|
11
|
+
# use require, see https://github.com/puma/puma/pull/2381
|
14
12
|
require 'puma/puma_http11'
|
13
|
+
|
15
14
|
require_relative 'puma/detect'
|
16
15
|
require_relative 'puma/json_serialization'
|
17
|
-
require_relative 'rack/version_restriction'
|
18
16
|
|
19
17
|
module Puma
|
20
|
-
|
21
|
-
|
22
|
-
autoload :
|
18
|
+
# when Puma is loaded via `Puma::CLI`, all files are loaded via
|
19
|
+
# `require_relative`. The below are for non-standard loading
|
20
|
+
autoload :Const, "#{__dir__}/puma/const"
|
21
|
+
autoload :Server, "#{__dir__}/puma/server"
|
22
|
+
autoload :Launcher, "#{__dir__}/puma/launcher"
|
23
|
+
autoload :LogWriter, "#{__dir__}/puma/log_writer"
|
23
24
|
|
24
25
|
# at present, MiniSSL::Engine is only defined in extension code (puma_http11),
|
25
26
|
# not in minissl.rb
|
@@ -28,7 +29,7 @@ module Puma
|
|
28
29
|
HAS_UNIX_SOCKET = Object.const_defined?(:UNIXSocket) && !IS_WINDOWS
|
29
30
|
|
30
31
|
if HAS_SSL
|
31
|
-
|
32
|
+
require_relative 'puma/minissl'
|
32
33
|
else
|
33
34
|
module MiniSSL
|
34
35
|
# this class is defined so that it exists when Puma is compiled
|
@@ -71,9 +72,7 @@ module Puma
|
|
71
72
|
@get_stats.stats
|
72
73
|
end
|
73
74
|
|
74
|
-
# Thread name is new in Ruby 2.3
|
75
75
|
def self.set_thread_name(name)
|
76
|
-
return unless Thread.current.respond_to?(:name=)
|
77
76
|
Thread.current.name = "puma #{name}"
|
78
77
|
end
|
79
78
|
end
|
data/lib/rack/handler/puma.rb
CHANGED
@@ -1,114 +1,144 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
module
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
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
|
+
|
8
|
+
module RackHandler
|
9
|
+
DEFAULT_OPTIONS = {
|
10
|
+
:Verbose => false,
|
11
|
+
:Silent => false
|
12
|
+
}
|
13
|
+
|
14
|
+
def config(app, options = {})
|
15
|
+
require_relative '../../puma'
|
16
|
+
require_relative '../../puma/configuration'
|
17
|
+
require_relative '../../puma/log_writer'
|
18
|
+
require_relative '../../puma/launcher'
|
19
|
+
|
20
|
+
default_options = DEFAULT_OPTIONS.dup
|
21
|
+
|
22
|
+
# Libraries pass in values such as :Port and there is no way to determine
|
23
|
+
# if it is a default provided by the library or a special value provided
|
24
|
+
# by the user. A special key `user_supplied_options` can be passed. This
|
25
|
+
# contains an array of all explicitly defined user options. We then
|
26
|
+
# know that all other values are defaults
|
27
|
+
if user_supplied_options = options.delete(:user_supplied_options)
|
28
|
+
(options.keys - user_supplied_options).each do |k|
|
29
|
+
default_options[k] = options.delete(k)
|
30
30
|
end
|
31
|
+
end
|
31
32
|
|
32
|
-
|
33
|
-
if options.delete(:Verbose)
|
34
|
-
require 'rack/common_logger'
|
35
|
-
app = Rack::CommonLogger.new(app, STDOUT)
|
36
|
-
end
|
33
|
+
@events = options[:events] || ::Puma::Events.new
|
37
34
|
|
38
|
-
|
39
|
-
|
35
|
+
conf = ::Puma::Configuration.new(options, default_options.merge({events: @events})) do |user_config, file_config, default_config|
|
36
|
+
if options.delete(:Verbose)
|
37
|
+
begin
|
38
|
+
require 'rack/commonlogger' # Rack 1.x
|
39
|
+
rescue LoadError
|
40
|
+
require 'rack/common_logger' # Rack 2 and later
|
40
41
|
end
|
42
|
+
app = ::Rack::CommonLogger.new(app, STDOUT)
|
43
|
+
end
|
41
44
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
end
|
45
|
+
if options[:environment]
|
46
|
+
user_config.environment options[:environment]
|
47
|
+
end
|
46
48
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
end
|
49
|
+
if options[:Threads]
|
50
|
+
min, max = options.delete(:Threads).split(':', 2)
|
51
|
+
user_config.threads min, max
|
52
|
+
end
|
52
53
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
self.set_host_port_to_config(
|
54
|
+
if options[:Host] || options[:Port]
|
55
|
+
host = options[:Host] || default_options[:Host]
|
56
|
+
port = options[:Port] || default_options[:Port]
|
57
|
+
self.set_host_port_to_config(host, port, user_config)
|
58
|
+
end
|
57
59
|
|
58
|
-
|
60
|
+
if default_options[:Host]
|
61
|
+
file_config.set_default_host(default_options[:Host])
|
59
62
|
end
|
60
|
-
|
63
|
+
self.set_host_port_to_config(default_options[:Host], default_options[:Port], default_config)
|
64
|
+
|
65
|
+
user_config.app app
|
61
66
|
end
|
67
|
+
conf
|
68
|
+
end
|
62
69
|
|
63
|
-
|
64
|
-
|
70
|
+
def run(app, **options)
|
71
|
+
conf = self.config(app, options)
|
65
72
|
|
66
|
-
|
73
|
+
log_writer = options.delete(:Silent) ? ::Puma::LogWriter.strings : ::Puma::LogWriter.stdio
|
67
74
|
|
68
|
-
|
75
|
+
launcher = ::Puma::Launcher.new(conf, :log_writer => log_writer, events: @events)
|
69
76
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
end
|
77
|
+
yield launcher if block_given?
|
78
|
+
begin
|
79
|
+
launcher.run
|
80
|
+
rescue Interrupt
|
81
|
+
puts "* Gracefully stopping, waiting for requests to finish"
|
82
|
+
launcher.stop
|
83
|
+
puts "* Goodbye!"
|
78
84
|
end
|
85
|
+
end
|
79
86
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
87
|
+
def valid_options
|
88
|
+
{
|
89
|
+
"Host=HOST" => "Hostname to listen on (default: localhost)",
|
90
|
+
"Port=PORT" => "Port to listen on (default: 8080)",
|
91
|
+
"Threads=MIN:MAX" => "min:max threads to use (default 0:16)",
|
92
|
+
"Verbose" => "Don't report each request (default: false)"
|
93
|
+
}
|
94
|
+
end
|
88
95
|
|
89
|
-
|
90
|
-
|
96
|
+
def set_host_port_to_config(host, port, config)
|
97
|
+
config.clear_binds! if host || port
|
91
98
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
+
if host&.start_with? '.', '/', '@'
|
100
|
+
config.bind "unix://#{host}"
|
101
|
+
elsif host&.start_with? 'ssl://'
|
102
|
+
uri = URI.parse(host)
|
103
|
+
uri.port ||= port || ::Puma::Configuration::DEFAULTS[:tcp_port]
|
104
|
+
config.bind uri.to_s
|
105
|
+
else
|
99
106
|
|
100
|
-
|
101
|
-
|
102
|
-
|
107
|
+
if host
|
108
|
+
port ||= ::Puma::Configuration::DEFAULTS[:tcp_port]
|
109
|
+
end
|
103
110
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
end
|
111
|
+
if port
|
112
|
+
host ||= ::Puma::Configuration::DEFAULTS[:tcp_host]
|
113
|
+
config.port port, host
|
108
114
|
end
|
109
115
|
end
|
110
116
|
end
|
117
|
+
end
|
118
|
+
end
|
111
119
|
|
112
|
-
|
120
|
+
# rackup was removed in Rack 3, it is now a separate gem
|
121
|
+
if Object.const_defined?(:Rackup) && ::Rackup.const_defined?(:Handler)
|
122
|
+
module Rackup
|
123
|
+
module Handler
|
124
|
+
module Puma
|
125
|
+
class << self
|
126
|
+
include ::Puma::RackHandler
|
127
|
+
end
|
128
|
+
end
|
129
|
+
register :puma, Puma
|
130
|
+
end
|
131
|
+
end
|
132
|
+
else
|
133
|
+
do_register = Object.const_defined?(:Rack) && ::Rack.release < '3'
|
134
|
+
module Rack
|
135
|
+
module Handler
|
136
|
+
module Puma
|
137
|
+
class << self
|
138
|
+
include ::Puma::RackHandler
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
113
142
|
end
|
143
|
+
::Rack::Handler.register(:puma, ::Rack::Handler::Puma) if do_register
|
114
144
|
end
|
data/tools/Dockerfile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Use this Dockerfile to create minimal reproductions of issues
|
2
2
|
|
3
|
-
FROM ruby:3.
|
3
|
+
FROM ruby:3.2
|
4
4
|
|
5
5
|
# throw errors if Gemfile has been modified since Gemfile.lock
|
6
6
|
RUN bundle config --global frozen 1
|
@@ -8,7 +8,7 @@ RUN bundle config --global frozen 1
|
|
8
8
|
WORKDIR /usr/src/app
|
9
9
|
|
10
10
|
COPY . .
|
11
|
-
|
11
|
+
|
12
12
|
RUN bundle install
|
13
13
|
RUN bundle exec rake compile
|
14
14
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 6.6.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Evan Phoenix
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -24,10 +24,11 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.0'
|
27
|
-
description:
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
description: |
|
28
|
+
Puma is a simple, fast, multi-threaded, and highly parallel HTTP 1.1 server
|
29
|
+
for Ruby/Rack applications. Puma is intended for use in both development and
|
30
|
+
production environments. It's great for highly parallel Ruby implementations such as
|
31
|
+
JRuby and TruffleRuby as well as as providing process worker support to support CRuby well.
|
31
32
|
email:
|
32
33
|
- evan@phx.io
|
33
34
|
executables:
|
@@ -49,6 +50,7 @@ files:
|
|
49
50
|
- docs/images/puma-connection-flow-no-reactor.png
|
50
51
|
- docs/images/puma-connection-flow.png
|
51
52
|
- docs/images/puma-general-arch.png
|
53
|
+
- docs/java_options.md
|
52
54
|
- docs/jungle/README.md
|
53
55
|
- docs/jungle/rc.d/README.md
|
54
56
|
- docs/jungle/rc.d/puma
|
@@ -61,6 +63,8 @@ files:
|
|
61
63
|
- docs/signals.md
|
62
64
|
- docs/stats.md
|
63
65
|
- docs/systemd.md
|
66
|
+
- docs/testing_benchmarks_local_files.md
|
67
|
+
- docs/testing_test_rackup_ci_files.md
|
64
68
|
- ext/puma_http11/PumaHttp11Service.java
|
65
69
|
- ext/puma_http11/ext_help.h
|
66
70
|
- ext/puma_http11/extconf.rb
|
@@ -95,27 +99,28 @@ files:
|
|
95
99
|
- lib/puma/jruby_restart.rb
|
96
100
|
- lib/puma/json_serialization.rb
|
97
101
|
- lib/puma/launcher.rb
|
102
|
+
- lib/puma/launcher/bundle_pruner.rb
|
103
|
+
- lib/puma/log_writer.rb
|
98
104
|
- lib/puma/minissl.rb
|
99
105
|
- lib/puma/minissl/context_builder.rb
|
100
106
|
- lib/puma/null_io.rb
|
101
107
|
- lib/puma/plugin.rb
|
108
|
+
- lib/puma/plugin/systemd.rb
|
102
109
|
- lib/puma/plugin/tmp_restart.rb
|
103
110
|
- lib/puma/puma_http11.jar
|
104
|
-
- lib/puma/queue_close.rb
|
105
111
|
- lib/puma/rack/builder.rb
|
106
112
|
- lib/puma/rack/urlmap.rb
|
107
113
|
- lib/puma/rack_default.rb
|
108
114
|
- lib/puma/reactor.rb
|
109
115
|
- lib/puma/request.rb
|
110
116
|
- lib/puma/runner.rb
|
117
|
+
- lib/puma/sd_notify.rb
|
111
118
|
- lib/puma/server.rb
|
112
119
|
- lib/puma/single.rb
|
113
120
|
- lib/puma/state_file.rb
|
114
|
-
- lib/puma/systemd.rb
|
115
121
|
- lib/puma/thread_pool.rb
|
116
122
|
- lib/puma/util.rb
|
117
123
|
- lib/rack/handler/puma.rb
|
118
|
-
- lib/rack/version_restriction.rb
|
119
124
|
- tools/Dockerfile
|
120
125
|
- tools/trickletest.rb
|
121
126
|
homepage: https://puma.io
|
@@ -126,6 +131,7 @@ metadata:
|
|
126
131
|
changelog_uri: https://github.com/puma/puma/blob/master/History.md
|
127
132
|
homepage_uri: https://puma.io
|
128
133
|
source_code_uri: https://github.com/puma/puma
|
134
|
+
rubygems_mfa_required: 'true'
|
129
135
|
post_install_message:
|
130
136
|
rdoc_options: []
|
131
137
|
require_paths:
|
@@ -134,7 +140,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
134
140
|
requirements:
|
135
141
|
- - ">="
|
136
142
|
- !ruby/object:Gem::Version
|
137
|
-
version: '2.
|
143
|
+
version: '2.4'
|
138
144
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
145
|
requirements:
|
140
146
|
- - ">="
|
@@ -144,6 +150,5 @@ requirements: []
|
|
144
150
|
rubygems_version: 3.3.26
|
145
151
|
signing_key:
|
146
152
|
specification_version: 4
|
147
|
-
summary:
|
148
|
-
Ruby/Rack applications
|
153
|
+
summary: A Ruby/Rack web server built for parallelism.
|
149
154
|
test_files: []
|
data/lib/puma/queue_close.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
class ClosedQueueError < StandardError; end
|
2
|
-
module Puma
|
3
|
-
|
4
|
-
# Queue#close was added in Ruby 2.3.
|
5
|
-
# Add a simple implementation for earlier Ruby versions.
|
6
|
-
#
|
7
|
-
module QueueClose
|
8
|
-
def close
|
9
|
-
num_waiting.times {push nil}
|
10
|
-
@closed = true
|
11
|
-
end
|
12
|
-
def closed?
|
13
|
-
@closed ||= false
|
14
|
-
end
|
15
|
-
def push(object)
|
16
|
-
raise ClosedQueueError if closed?
|
17
|
-
super
|
18
|
-
end
|
19
|
-
alias << push
|
20
|
-
def pop(non_block=false)
|
21
|
-
return nil if !non_block && closed? && empty?
|
22
|
-
super
|
23
|
-
end
|
24
|
-
end
|
25
|
-
::Queue.prepend QueueClose
|
26
|
-
end
|