puma 5.0.0 → 5.0.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puma might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/History.md +1126 -574
- data/lib/puma.rb +5 -2
- data/lib/puma/binder.rb +2 -0
- data/lib/puma/client.rb +5 -1
- data/lib/puma/cluster.rb +2 -0
- data/lib/puma/const.rb +1 -1
- data/lib/puma/error_logger.rb +2 -2
- data/lib/puma/events.rb +5 -3
- data/lib/puma/launcher.rb +8 -0
- data/lib/puma/minissl.rb +8 -0
- data/lib/puma/reactor.rb +2 -13
- data/lib/puma/runner.rb +4 -17
- data/lib/puma/server.rb +92 -64
- data/lib/puma/single.rb +1 -0
- data/lib/puma/thread_pool.rb +22 -2
- data/lib/puma/util.rb +1 -0
- metadata +6 -6
data/lib/puma/single.rb
CHANGED
data/lib/puma/thread_pool.rb
CHANGED
@@ -62,6 +62,8 @@ module Puma
|
|
62
62
|
end
|
63
63
|
|
64
64
|
@clean_thread_locals = false
|
65
|
+
@force_shutdown = false
|
66
|
+
@shutdown_mutex = Mutex.new
|
65
67
|
end
|
66
68
|
|
67
69
|
attr_reader :spawned, :trim_requested, :waiting
|
@@ -80,10 +82,12 @@ module Puma
|
|
80
82
|
with_mutex { @todo.size }
|
81
83
|
end
|
82
84
|
|
85
|
+
# @!attribute [r] pool_capacity
|
83
86
|
def pool_capacity
|
84
87
|
waiting + (@max - spawned)
|
85
88
|
end
|
86
89
|
|
90
|
+
# @!attribute [r] busy_threads
|
87
91
|
# @version 5.0.0
|
88
92
|
def busy_threads
|
89
93
|
with_mutex { @spawned - @waiting + @todo.size }
|
@@ -322,6 +326,19 @@ module Puma
|
|
322
326
|
@reaper.start!
|
323
327
|
end
|
324
328
|
|
329
|
+
# Allows ThreadPool::ForceShutdown to be raised within the
|
330
|
+
# provided block if the thread is forced to shutdown during execution.
|
331
|
+
def with_force_shutdown
|
332
|
+
t = Thread.current
|
333
|
+
@shutdown_mutex.synchronize do
|
334
|
+
raise ForceShutdown if @force_shutdown
|
335
|
+
t[:with_force_shutdown] = true
|
336
|
+
end
|
337
|
+
yield
|
338
|
+
ensure
|
339
|
+
t[:with_force_shutdown] = false
|
340
|
+
end
|
341
|
+
|
325
342
|
# Tell all threads in the pool to exit and wait for them to finish.
|
326
343
|
# Wait +timeout+ seconds then raise +ForceShutdown+ in remaining threads.
|
327
344
|
# Next, wait an extra +grace+ seconds then force-kill remaining threads.
|
@@ -356,8 +373,11 @@ module Puma
|
|
356
373
|
join.call(timeout)
|
357
374
|
|
358
375
|
# If threads are still running, raise ForceShutdown and wait to finish.
|
359
|
-
|
360
|
-
|
376
|
+
@shutdown_mutex.synchronize do
|
377
|
+
@force_shutdown = true
|
378
|
+
threads.each do |t|
|
379
|
+
t.raise ForceShutdown if t[:with_force_shutdown]
|
380
|
+
end
|
361
381
|
end
|
362
382
|
join.call(SHUTDOWN_GRACE_TIME)
|
363
383
|
|
data/lib/puma/util.rb
CHANGED
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: 5.0.
|
4
|
+
version: 5.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evan Phoenix
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nio4r
|
@@ -119,7 +119,7 @@ metadata:
|
|
119
119
|
changelog_uri: https://github.com/puma/puma/blob/master/History.md
|
120
120
|
homepage_uri: https://puma.io
|
121
121
|
source_code_uri: https://github.com/puma/puma
|
122
|
-
post_install_message:
|
122
|
+
post_install_message:
|
123
123
|
rdoc_options: []
|
124
124
|
require_paths:
|
125
125
|
- lib
|
@@ -134,8 +134,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
134
|
- !ruby/object:Gem::Version
|
135
135
|
version: '0'
|
136
136
|
requirements: []
|
137
|
-
rubygems_version: 3.
|
138
|
-
signing_key:
|
137
|
+
rubygems_version: 3.0.3
|
138
|
+
signing_key:
|
139
139
|
specification_version: 4
|
140
140
|
summary: Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server for
|
141
141
|
Ruby/Rack applications
|