puma 4.1.1-java → 4.2.0-java
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 +31 -7
- data/README.md +5 -16
- data/ext/puma_http11/http11_parser.c +37 -62
- data/ext/puma_http11/http11_parser_common.rl +3 -3
- data/lib/puma.rb +6 -0
- data/lib/puma/app/status.rb +29 -28
- data/lib/puma/binder.rb +32 -10
- data/lib/puma/cli.rb +4 -0
- data/lib/puma/client.rb +191 -203
- data/lib/puma/cluster.rb +14 -12
- data/lib/puma/const.rb +15 -18
- data/lib/puma/control_cli.rb +11 -2
- data/lib/puma/dsl.rb +16 -0
- data/lib/puma/launcher.rb +90 -46
- data/lib/puma/plugin.rb +5 -2
- data/lib/puma/puma_http11.jar +0 -0
- data/lib/puma/reactor.rb +5 -4
- data/lib/puma/runner.rb +3 -3
- data/lib/puma/server.rb +11 -5
- data/lib/puma/single.rb +1 -0
- data/lib/puma/thread_pool.rb +9 -31
- data/lib/rack/handler/puma.rb +0 -2
- data/tools/docker/Dockerfile +16 -0
- data/tools/trickletest.rb +0 -1
- metadata +6 -4
- data/lib/puma/daemon_ext.rb +0 -33
data/lib/puma/runner.rb
CHANGED
@@ -53,12 +53,12 @@ module Puma
|
|
53
53
|
|
54
54
|
uri = URI.parse str
|
55
55
|
|
56
|
-
app = Puma::App::Status.new @launcher
|
57
|
-
|
58
56
|
if token = @options[:control_auth_token]
|
59
|
-
|
57
|
+
token = nil if token.empty? || token == 'none'
|
60
58
|
end
|
61
59
|
|
60
|
+
app = Puma::App::Status.new @launcher, token
|
61
|
+
|
62
62
|
control = Puma::Server.new app, @launcher.events
|
63
63
|
control.min_threads = 0
|
64
64
|
control.max_threads = 1
|
data/lib/puma/server.rb
CHANGED
@@ -207,7 +207,10 @@ module Puma
|
|
207
207
|
@events.fire :state, :running
|
208
208
|
|
209
209
|
if background
|
210
|
-
@thread = Thread.new
|
210
|
+
@thread = Thread.new do
|
211
|
+
Puma.set_thread_name "server"
|
212
|
+
handle_servers_lopez_mode
|
213
|
+
end
|
211
214
|
return @thread
|
212
215
|
else
|
213
216
|
handle_servers_lopez_mode
|
@@ -317,7 +320,7 @@ module Puma
|
|
317
320
|
|
318
321
|
@events.ssl_error self, addr, cert, e
|
319
322
|
rescue HttpParserError => e
|
320
|
-
client.
|
323
|
+
client.write_error(400)
|
321
324
|
client.close
|
322
325
|
|
323
326
|
@events.parse_error self, client.env, e
|
@@ -351,7 +354,10 @@ module Puma
|
|
351
354
|
@events.fire :state, :running
|
352
355
|
|
353
356
|
if background
|
354
|
-
@thread = Thread.new
|
357
|
+
@thread = Thread.new do
|
358
|
+
Puma.set_thread_name "server"
|
359
|
+
handle_servers
|
360
|
+
end
|
355
361
|
return @thread
|
356
362
|
else
|
357
363
|
handle_servers
|
@@ -505,7 +511,7 @@ module Puma
|
|
505
511
|
rescue HttpParserError => e
|
506
512
|
lowlevel_error(e, client.env)
|
507
513
|
|
508
|
-
client.
|
514
|
+
client.write_error(400)
|
509
515
|
|
510
516
|
@events.parse_error self, client.env, e
|
511
517
|
|
@@ -513,7 +519,7 @@ module Puma
|
|
513
519
|
rescue StandardError => e
|
514
520
|
lowlevel_error(e, client.env)
|
515
521
|
|
516
|
-
client.
|
522
|
+
client.write_error(500)
|
517
523
|
|
518
524
|
@events.unknown_error self, e, "Read"
|
519
525
|
|
data/lib/puma/single.rb
CHANGED
data/lib/puma/thread_pool.rb
CHANGED
@@ -87,8 +87,7 @@ module Puma
|
|
87
87
|
@spawned += 1
|
88
88
|
|
89
89
|
th = Thread.new(@spawned) do |spawned|
|
90
|
-
|
91
|
-
Thread.current.name = 'puma %03i' % spawned if Thread.current.respond_to?(:name=)
|
90
|
+
Puma.set_thread_name 'threadpool %03i' % spawned
|
92
91
|
todo = @todo
|
93
92
|
block = @block
|
94
93
|
mutex = @mutex
|
@@ -244,10 +243,12 @@ module Puma
|
|
244
243
|
end
|
245
244
|
end
|
246
245
|
|
247
|
-
class
|
248
|
-
def initialize(pool, timeout)
|
246
|
+
class Automaton
|
247
|
+
def initialize(pool, timeout, thread_name, message)
|
249
248
|
@pool = pool
|
250
249
|
@timeout = timeout
|
250
|
+
@thread_name = thread_name
|
251
|
+
@message = message
|
251
252
|
@running = false
|
252
253
|
end
|
253
254
|
|
@@ -255,8 +256,9 @@ module Puma
|
|
255
256
|
@running = true
|
256
257
|
|
257
258
|
@thread = Thread.new do
|
259
|
+
Puma.set_thread_name @thread_name
|
258
260
|
while @running
|
259
|
-
@pool.
|
261
|
+
@pool.public_send(@message)
|
260
262
|
sleep @timeout
|
261
263
|
end
|
262
264
|
end
|
@@ -269,36 +271,12 @@ module Puma
|
|
269
271
|
end
|
270
272
|
|
271
273
|
def auto_trim!(timeout=30)
|
272
|
-
@auto_trim =
|
274
|
+
@auto_trim = Automaton.new(self, timeout, "threadpool trimmer", :trim)
|
273
275
|
@auto_trim.start!
|
274
276
|
end
|
275
277
|
|
276
|
-
class Reaper
|
277
|
-
def initialize(pool, timeout)
|
278
|
-
@pool = pool
|
279
|
-
@timeout = timeout
|
280
|
-
@running = false
|
281
|
-
end
|
282
|
-
|
283
|
-
def start!
|
284
|
-
@running = true
|
285
|
-
|
286
|
-
@thread = Thread.new do
|
287
|
-
while @running
|
288
|
-
@pool.reap
|
289
|
-
sleep @timeout
|
290
|
-
end
|
291
|
-
end
|
292
|
-
end
|
293
|
-
|
294
|
-
def stop
|
295
|
-
@running = false
|
296
|
-
@thread.wakeup
|
297
|
-
end
|
298
|
-
end
|
299
|
-
|
300
278
|
def auto_reap!(timeout=5)
|
301
|
-
@reaper =
|
279
|
+
@reaper = Automaton.new(self, timeout, "threadpool reaper", :reap)
|
302
280
|
@reaper.start!
|
303
281
|
end
|
304
282
|
|
data/lib/rack/handler/puma.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
# Use this Dockerfile to create minimal reproductions of issues
|
2
|
+
|
3
|
+
FROM ruby:2.6
|
4
|
+
|
5
|
+
# throw errors if Gemfile has been modified since Gemfile.lock
|
6
|
+
RUN bundle config --global frozen 1
|
7
|
+
|
8
|
+
WORKDIR /usr/src/app
|
9
|
+
|
10
|
+
COPY . .
|
11
|
+
RUN gem install bundler
|
12
|
+
RUN bundle install
|
13
|
+
RUN bundle exec rake compile
|
14
|
+
|
15
|
+
EXPOSE 9292
|
16
|
+
CMD bundle exec bin/puma test/rackup/hello.ru
|
data/tools/trickletest.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: 4.
|
4
|
+
version: 4.2.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: 2019-09-
|
11
|
+
date: 2019-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -79,7 +79,6 @@ files:
|
|
79
79
|
- lib/puma/const.rb
|
80
80
|
- lib/puma/control_cli.rb
|
81
81
|
- lib/puma/convenient.rb
|
82
|
-
- lib/puma/daemon_ext.rb
|
83
82
|
- lib/puma/delegation.rb
|
84
83
|
- lib/puma/detect.rb
|
85
84
|
- lib/puma/dsl.rb
|
@@ -104,6 +103,7 @@ files:
|
|
104
103
|
- lib/puma/thread_pool.rb
|
105
104
|
- lib/puma/util.rb
|
106
105
|
- lib/rack/handler/puma.rb
|
106
|
+
- tools/docker/Dockerfile
|
107
107
|
- tools/jungle/README.md
|
108
108
|
- tools/jungle/init.d/README.md
|
109
109
|
- tools/jungle/init.d/puma
|
@@ -120,6 +120,7 @@ licenses:
|
|
120
120
|
- BSD-3-Clause
|
121
121
|
metadata:
|
122
122
|
msys2_mingw_dependencies: openssl
|
123
|
+
changelog_uri: https://github.com/puma/puma/blob/master/History.md
|
123
124
|
post_install_message:
|
124
125
|
rdoc_options: []
|
125
126
|
require_paths:
|
@@ -135,7 +136,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
136
|
- !ruby/object:Gem::Version
|
136
137
|
version: '0'
|
137
138
|
requirements: []
|
138
|
-
|
139
|
+
rubyforge_project:
|
140
|
+
rubygems_version: 2.7.9
|
139
141
|
signing_key:
|
140
142
|
specification_version: 4
|
141
143
|
summary: Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server for
|
data/lib/puma/daemon_ext.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Process
|
4
|
-
|
5
|
-
# This overrides the default version because it is broken if it
|
6
|
-
# exists.
|
7
|
-
|
8
|
-
if respond_to? :daemon
|
9
|
-
class << self
|
10
|
-
remove_method :daemon
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.daemon(nochdir=false, noclose=false)
|
15
|
-
exit if fork # Parent exits, child continues.
|
16
|
-
|
17
|
-
Process.setsid # Become session leader.
|
18
|
-
|
19
|
-
exit if fork # Zap session leader. See [1].
|
20
|
-
|
21
|
-
Dir.chdir "/" unless nochdir # Release old working directory.
|
22
|
-
|
23
|
-
if !noclose
|
24
|
-
STDIN.reopen File.open("/dev/null", "r")
|
25
|
-
|
26
|
-
null_out = File.open "/dev/null", "w"
|
27
|
-
STDOUT.reopen null_out
|
28
|
-
STDERR.reopen null_out
|
29
|
-
end
|
30
|
-
|
31
|
-
0
|
32
|
-
end
|
33
|
-
end
|