puma 5.0.1 → 5.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5fbb8e41c911f790de45695555dbbaaec62267a3ecbee2d77c63836d6b24fed8
4
- data.tar.gz: 0c058d33c862cf274e7d4d6b57499da594d8c703a90b60cbd5b518a184193253
3
+ metadata.gz: 5288b12515ced761374a9789a16f4e0b66b6acdb94046d5d12b9999097224626
4
+ data.tar.gz: 5507be3e76794c32f7cce1e72291ce1fbc93eee8fc4986fa8a99b0aac0b7efbf
5
5
  SHA512:
6
- metadata.gz: 75ba396a62ac7723aa196608650121491e1e44bfa472b5a17919b1efec0efcc219da2ebeec75092d19c883d2a1519993f7a251f5ff0e717a3e773d75974337f9
7
- data.tar.gz: a333da0c47c27cfd18daacb49fb179defa5978a6c6ddb9144fb1dc56abfc021887e7a137c84da12e339afcb0636596cc1aa025b8181e98e2a45ca0fb26c6efe8
6
+ metadata.gz: f0f04bf4b3b75cab397783d89ad46031c023d8b1f90e6297085d542cb3e77ef5c7dc3a278f73b13e0e7490b9a4dee15b95f9548a58e69e4a9a67f35cc332f56b
7
+ data.tar.gz: b547445e6976b1cf58b221ac5810359e343ba0242b3ea58675b2f2be8367bba98c325c100f6a63766f6c02289f7763d6a93485484202895eed7f5e16c9a17753
data/History.md CHANGED
@@ -6,6 +6,11 @@
6
6
  * Bugfixes
7
7
  * Your bugfix goes here <Most recent on the top, like GitHub> (#Github Number)
8
8
 
9
+ ## 5.0.2 / 2020-09-28
10
+
11
+ * Bugfixes
12
+ * Reverted API changes to Server.
13
+
9
14
  ## 5.0.1 / 2020-09-28
10
15
 
11
16
  * Bugfixes
@@ -100,7 +100,7 @@ module Puma
100
100
  # too taxing on performance.
101
101
  module Const
102
102
 
103
- PUMA_VERSION = VERSION = "5.0.1".freeze
103
+ PUMA_VERSION = VERSION = "5.0.2".freeze
104
104
  CODE_NAME = "Spoony Bard".freeze
105
105
 
106
106
  PUMA_SERVER_STRING = ['puma', PUMA_VERSION, CODE_NAME].join(' ').freeze
@@ -54,8 +54,9 @@ module Puma
54
54
 
55
55
  app = Puma::App::Status.new @launcher, token
56
56
 
57
- control = Puma::Server.new app, @launcher.events,
58
- { min_threads: 0, max_threads: 1 }
57
+ control = Puma::Server.new app, @launcher.events
58
+ control.min_threads = 0
59
+ control.max_threads = 1
59
60
 
60
61
  control.binder.parse [str], self, 'Starting control server'
61
62
 
@@ -68,7 +69,6 @@ module Puma
68
69
  @control.binder.close_listeners if @control
69
70
  end
70
71
 
71
- # @!attribute [r] ruby_engine
72
72
  def ruby_engine
73
73
  if !defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby"
74
74
  "ruby #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"
@@ -137,14 +137,27 @@ module Puma
137
137
  @launcher.binder.parse @options[:binds], self
138
138
  end
139
139
 
140
- # @!attribute [r] app
141
140
  def app
142
141
  @app ||= @launcher.config.app
143
142
  end
144
143
 
145
144
  def start_server
145
+ min_t = @options[:min_threads]
146
+ max_t = @options[:max_threads]
147
+
146
148
  server = Puma::Server.new app, @launcher.events, @options
149
+ server.min_threads = min_t
150
+ server.max_threads = max_t
147
151
  server.inherit_binder @launcher.binder
152
+
153
+ if @options[:early_hints]
154
+ server.early_hints = true
155
+ end
156
+
157
+ unless development? || test?
158
+ server.leak_stack_on_error = false
159
+ end
160
+
148
161
  server
149
162
  end
150
163
  end
@@ -34,21 +34,15 @@ module Puma
34
34
 
35
35
  attr_reader :thread
36
36
  attr_reader :events
37
- attr_reader :min_threads, :max_threads # for #stats
38
- attr_reader :requests_count # @version 5.0.0
39
-
40
- # the following may be deprecated in the future
41
- attr_reader :auto_trim_time
42
- attr_reader :first_data_timeout
43
- attr_reader :persistent_timeout
44
- attr_reader :reaping_time
45
-
37
+ attr_reader :requests_count # @version 5.0.0
46
38
  attr_accessor :app
47
- attr_accessor :binder
48
39
 
49
- def_delegators :@binder, :add_tcp_listener, :add_ssl_listener, :add_unix_listener, :connected_ports
50
-
51
- ThreadLocalKey = :puma_server
40
+ attr_accessor :min_threads
41
+ attr_accessor :max_threads
42
+ attr_accessor :persistent_timeout
43
+ attr_accessor :auto_trim_time
44
+ attr_accessor :reaping_time
45
+ attr_accessor :first_data_timeout
52
46
 
53
47
  # Create a server for the rack app +app+.
54
48
  #
@@ -58,10 +52,6 @@ module Puma
58
52
  # Server#run returns a thread that you can join on to wait for the server
59
53
  # to do its work.
60
54
  #
61
- # @note Several instance variables exist so they are available for testing,
62
- # and have default values set via +fetch+. Normally the values are set via
63
- # `::Puma::Configuration.puma_default_options`.
64
- #
65
55
  def initialize(app, events=Events.stdio, options={})
66
56
  @app = app
67
57
  @events = events
@@ -69,24 +59,24 @@ module Puma
69
59
  @check, @notify = nil
70
60
  @status = :stop
71
61
 
62
+ @min_threads = 0
63
+ @max_threads = 16
72
64
  @auto_trim_time = 30
73
65
  @reaping_time = 1
74
66
 
75
67
  @thread = nil
76
68
  @thread_pool = nil
69
+ @early_hints = nil
77
70
 
78
- @options = options
71
+ @persistent_timeout = options.fetch(:persistent_timeout, PERSISTENT_TIMEOUT)
72
+ @first_data_timeout = options.fetch(:first_data_timeout, FIRST_DATA_TIMEOUT)
79
73
 
80
- @early_hints = options.fetch :early_hints, nil
81
- @first_data_timeout = options.fetch :first_data_timeout, FIRST_DATA_TIMEOUT
82
- @min_threads = options.fetch :min_threads, 0
83
- @max_threads = options.fetch :max_threads , (Puma.mri? ? 5 : 16)
84
- @persistent_timeout = options.fetch :persistent_timeout, PERSISTENT_TIMEOUT
85
- @queue_requests = options.fetch :queue_requests, true
74
+ @binder = Binder.new(events)
86
75
 
87
- @leak_stack_on_error = !!(@options[:environment] =~ /\A(development|test)\z/)
76
+ @leak_stack_on_error = true
88
77
 
89
- @binder = Binder.new(events)
78
+ @options = options
79
+ @queue_requests = options[:queue_requests].nil? ? true : options[:queue_requests]
90
80
 
91
81
  ENV['RACK_ENV'] ||= "development"
92
82
 
@@ -99,16 +89,15 @@ module Puma
99
89
  @shutdown_mutex = Mutex.new
100
90
  end
101
91
 
92
+ attr_accessor :binder, :leak_stack_on_error, :early_hints
93
+
94
+ def_delegators :@binder, :add_tcp_listener, :add_ssl_listener, :add_unix_listener, :connected_ports
95
+
102
96
  def inherit_binder(bind)
103
97
  @binder = bind
104
98
  end
105
99
 
106
100
  class << self
107
- # @!attribute [r] current
108
- def current
109
- Thread.current[ThreadLocalKey]
110
- end
111
-
112
101
  # :nodoc:
113
102
  # @version 5.0.0
114
103
  def tcp_cork_supported?
@@ -183,12 +172,10 @@ module Puma
183
172
  end
184
173
  end
185
174
 
186
- # @!attribute [r] backlog
187
175
  def backlog
188
176
  @thread_pool and @thread_pool.backlog
189
177
  end
190
178
 
191
- # @!attribute [r] running
192
179
  def running
193
180
  @thread_pool and @thread_pool.spawned
194
181
  end
@@ -201,7 +188,6 @@ module Puma
201
188
  # there are 5 threads sitting idle ready to take
202
189
  # a request. If one request comes in, then the
203
190
  # value would be 4 until it finishes processing.
204
- # @!attribute [r] pool_capacity
205
191
  def pool_capacity
206
192
  @thread_pool and @thread_pool.pool_capacity
207
193
  end
@@ -1012,6 +998,12 @@ module Puma
1012
998
  end
1013
999
  private :fast_write
1014
1000
 
1001
+ ThreadLocalKey = :puma_server
1002
+
1003
+ def self.current
1004
+ Thread.current[ThreadLocalKey]
1005
+ end
1006
+
1015
1007
  def shutting_down?
1016
1008
  @status == :stop || @status == :restart
1017
1009
  end
@@ -1027,7 +1019,6 @@ module Puma
1027
1019
 
1028
1020
  # Returns a hash of stats about the running server for reporting purposes.
1029
1021
  # @version 5.0.0
1030
- # @!attribute [r] stats
1031
1022
  def stats
1032
1023
  STAT_METHODS.map {|name| [name, send(name) || 0]}.to_h
1033
1024
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puma
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.1
4
+ version: 5.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Phoenix