puma 2.8.1-java → 2.8.2-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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4a4ca5639981db20a9ea606243a312d164f63784
4
- data.tar.gz: c0a3a97591d9e3d52ebab9e91541437c7a739a86
3
+ metadata.gz: 4068c1ab9c07c255327a21b7cb9861c9262bf27f
4
+ data.tar.gz: 16d7ca45414cecb9d9bb5de419708f93dee10c31
5
5
  SHA512:
6
- metadata.gz: 940eb6f43f830a7c6247d7a0c14b5e30839365b884c78356a8f2c42f49db8e572f59a78ec4845ec4fc34188eee775e3cd3b87c566f44c6bf3f2cb4ed6ff2981f
7
- data.tar.gz: bf9ec90368f7b010753c05f665cbbd3b6afa6fbac8cc4430babcba247c5d64de5646840a483648db42b095fbc66af66f20778b18cfaf1b77365ee460ec7bca5f
6
+ metadata.gz: 96995f4f35e661d5520742532357c731678e809fbb8fc04b8b0d39f6cb35abd043178fae312315d76d0862809c98f0d4d82260d5a1b66e411a91561717f38025
7
+ data.tar.gz: 2fb7d98cc1acf55d9d9f6981ba7be452defb8eb45b4cbf8c5f6741aed35f48a159d6fe04c8601396cbe663578953cc920223c95ad8fc0c813f9bb34fe988dc28
@@ -1,3 +1,30 @@
1
+ === 2.8.2 / 2014-04-12
2
+
3
+ * 4 bug fixes:
4
+ * During upgrade, change directory in main process instead of workers.
5
+ * Close the client properly on error
6
+ * Capistrano: fallback from phased restart to start when not started
7
+ * Allow tag option in conf file
8
+
9
+ * 4 doc fixes:
10
+ * Fix Puma daemon service README typo
11
+ * `preload_app!` instead of `preload_app`
12
+ * add preload_app and prune_bundler to example config
13
+ * allow changing of worker_timeout in config file
14
+
15
+ * 11 PRs merged:
16
+ * Merge pull request #487 from ckuttruff/master
17
+ * Merge pull request #492 from ckuttruff/master
18
+ * Merge pull request #493 from alepore/config_tag
19
+ * Merge pull request #503 from mariuz/patch-1
20
+ * Merge pull request #505 from sammcj/patch-1
21
+ * Merge pull request #506 from FlavourSys/config_worker_timeout
22
+ * Merge pull request #510 from momer/rescue-block-handle-servers-fix
23
+ * Merge pull request #511 from macool/patch-1
24
+ * Merge pull request #514 from edogawaconan/refactor_env
25
+ * Merge pull request #517 from misfo/patch-1
26
+ * Merge pull request #518 from LongMan/master
27
+
1
28
  === 2.8.1 / 2014-03-06
2
29
 
3
30
  * 1 bug fixes:
data/README.md CHANGED
@@ -116,6 +116,10 @@ If you're preloading your application and using ActiveRecord, it's recommend you
116
116
  ActiveRecord::Base.establish_connection
117
117
  end
118
118
  end
119
+
120
+ When you use preload_app, your new code goes all in the master process, and is then copied in the workers (meaning it’s only compatible with cluster mode). General rule is to use preload_app when your workers die often and need fast starts. If you don’t have many workers, you should probably don’t use preload_app.
121
+
122
+ Note that preload_app can’t be used with phased restart, since phased restart kills and restarts workers one-by-one, and preload_app is all about copying the code of master into the workers.
119
123
 
120
124
  ### Binding TCP / Sockets
121
125
 
@@ -170,6 +174,19 @@ No code is shared between the current and restarted process, so it should be saf
170
174
 
171
175
  If the new process is unable to load, it will simply exit. You should therefore run Puma under a supervisor when using it in production.
172
176
 
177
+ ### Normal vs Hot vs Phased Restart
178
+
179
+ A hot restart means that no requests while deploying your new code will be lost, since the server socket is kept open between restarts.
180
+
181
+ But beware, hot restart does not mean that the incoming requests won’t hang for multiple seconds while your new code has not fully deployed. If you need a zero downtime and zero hanging requests deploy, you must use phased restart.
182
+
183
+ When you run pumactl phased-restart, Puma kills workers one-by-one, meaning that at least another worker is still available to serve requests, which lead in zero hanging request (yay!).
184
+
185
+ But again beware, upgrading an application sometimes involves upgrading the database schema. With phased restart, there may be a moment during the deployment where processes belonging to the previous version and processes belonging to the new version both exist at the same time. Any database schema upgrades you perform must therefore be backwards-compatible with the old application version.
186
+
187
+ if you perform a lot of database migrations, you probably should not use phased restart and use a normal/hot restart instead (pumactl restart). That way, no code is shared while deploying (in that case, preload_app might help for quicker deployment, see below).
188
+
189
+
173
190
  ### Cleanup Code
174
191
 
175
192
  Puma isn't able to understand all the resources that your app may use, so it provides a hook in the configuration file you pass to `-C` called `on_restart`. The block passed to `on_restart` will be called, unsurprisingly, just before Puma restarts itself.
@@ -194,12 +211,21 @@ If you want an easy way to manage multiple scripts at once check [tools/jungle](
194
211
 
195
212
  ## Capistrano deployment
196
213
 
197
- Puma has included Capistrano [deploy script](https://github.com/puma/puma/blob/master/lib/puma/capistrano.rb), you just need require that:
214
+ Puma has support for Capistrano3 with an [external gem](https://github.com/seuros/capistrano-puma), you just need require that in Gemfile:
215
+
216
+ ```ruby
217
+ gem 'capistrano3-puma'
218
+ ```
219
+ And then execute:
220
+
221
+ ```bash
222
+ bundle
223
+ ```
198
224
 
199
- config/deploy.rb
225
+ Then add to Capfile
200
226
 
201
227
  ```ruby
202
- require 'puma/capistrano'
228
+ require 'capistrano/puma'
203
229
  ```
204
230
 
205
231
  and then
data/Rakefile CHANGED
@@ -8,7 +8,6 @@ Hoe.plugin :git
8
8
  Hoe.plugin :ignore
9
9
 
10
10
  HOE = Hoe.spec "puma" do
11
- self.rubyforge_name = 'puma'
12
11
  self.readme_file = "README.md"
13
12
  self.urls = %w!http://puma.io https://github.com/puma/puma!
14
13
 
@@ -42,7 +42,12 @@ Capistrano::Configuration.instance.load do
42
42
 
43
43
  desc 'Restart puma (phased restart)'
44
44
  task :phased_restart, :roles => lambda { puma_role }, :on_no_matching_servers => :continue do
45
- run "cd #{current_path} && #{pumactl_cmd} -S #{state_path} phased-restart"
45
+ begin
46
+ run "cd #{current_path} && #{pumactl_cmd} -S #{state_path} phased-restart"
47
+ rescue Capistrano::CommandError => ex
48
+ puts "Failed to restart puma: #{ex}\nAssuming not started."
49
+ start
50
+ end
46
51
  end
47
52
 
48
53
  end
@@ -257,14 +257,13 @@ module Puma
257
257
  end
258
258
  end
259
259
 
260
- def set_rack_environment
260
+ def env
261
261
  # Try the user option first, then the environment variable,
262
262
  # finally default to development
263
+ @options[:environment] || ENV['RACK_ENV'] || 'development'
264
+ end
263
265
 
264
- env = @options[:environment] ||
265
- ENV['RACK_ENV'] ||
266
- 'development'
267
-
266
+ def set_rack_environment
268
267
  @options[:environment] = env
269
268
  ENV['RACK_ENV'] = env
270
269
  end
@@ -286,13 +285,7 @@ module Puma
286
285
  return
287
286
  end
288
287
 
289
- pos = []
290
-
291
- if env = (@options[:environment] || ENV['RACK_ENV'])
292
- pos << "config/puma/#{env}.rb"
293
- end
294
-
295
- pos << "config/puma.rb"
288
+ pos = ["config/puma/#{env}.rb", "config/puma.rb"]
296
289
  @options[:config_file] = pos.find { |f| File.exist? f }
297
290
  end
298
291
 
@@ -27,6 +27,13 @@ module Puma
27
27
  def start_phased_restart
28
28
  @phase += 1
29
29
  log "- Starting phased worker restart, phase: #{@phase}"
30
+
31
+ # Be sure to change the directory again before loading
32
+ # the app. This way we can pick up new code.
33
+ if dir = @options[:worker_directory]
34
+ log "+ Changing to #{dir}"
35
+ Dir.chdir dir
36
+ end
30
37
  end
31
38
 
32
39
  class Worker
@@ -80,14 +87,12 @@ module Puma
80
87
  def spawn_workers
81
88
  diff = @options[:workers] - @workers.size
82
89
 
83
- upgrade = (@phased_state == :waiting)
84
-
85
90
  master = Process.pid
86
91
 
87
92
  diff.times do
88
93
  idx = next_worker_index
89
94
 
90
- pid = fork { worker(idx, upgrade, master) }
95
+ pid = fork { worker(idx, master) }
91
96
  @cli.debug "Spawned worker: #{pid}"
92
97
  @workers << Worker.new(idx, pid, @phase)
93
98
  @options[:after_worker_boot].each { |h| h.call }
@@ -163,7 +168,7 @@ module Puma
163
168
  end
164
169
  end
165
170
 
166
- def worker(index, upgrade, master)
171
+ def worker(index, master)
167
172
  $0 = "puma: cluster worker #{index}: #{master}"
168
173
  Signal.trap "SIGINT", "IGNORE"
169
174
 
@@ -176,15 +181,6 @@ module Puma
176
181
  exit! 1
177
182
  end
178
183
 
179
- # Be sure to change the directory again before loading
180
- # the app. This way we can pick up new code.
181
- if upgrade
182
- if dir = @options[:worker_directory]
183
- log "+ Changing to #{dir}"
184
- Dir.chdir dir
185
- end
186
- end
187
-
188
184
  # If we're not running under a Bundler context, then
189
185
  # report the info about the context we will be using
190
186
  if !ENV['BUNDLER_GEMFILE'] and File.exist?("Gemfile")
@@ -362,6 +362,16 @@ module Puma
362
362
  def prune_bundler(answer=true)
363
363
  @options[:prune_bundler] = answer
364
364
  end
365
+
366
+ # Additional text to display in process listing
367
+ def tag(string)
368
+ @options[:tag] = string
369
+ end
370
+
371
+ # *Cluster mode only* Set the timeout for workers
372
+ def worker_timeout(timeout)
373
+ @options[:worker_timeout] = timeout
374
+ end
365
375
  end
366
376
  end
367
377
  end
@@ -28,7 +28,7 @@ module Puma
28
28
  # too taxing on performance.
29
29
  module Const
30
30
 
31
- PUMA_VERSION = VERSION = "2.8.1".freeze
31
+ PUMA_VERSION = VERSION = "2.8.2".freeze
32
32
  CODE_NAME = "Sir Edmund Percival Hillary".freeze
33
33
 
34
34
  FAST_TRACK_KA_TIMEOUT = 0.2
Binary file
@@ -185,8 +185,8 @@ module Puma
185
185
  else
186
186
  begin
187
187
  if io = sock.accept_nonblock
188
- c = Client.new io, nil
189
- pool << c
188
+ client = Client.new io, nil
189
+ pool << client
190
190
  end
191
191
  rescue SystemCallError
192
192
  end
@@ -292,8 +292,8 @@ module Puma
292
292
  else
293
293
  begin
294
294
  if io = sock.accept_nonblock
295
- c = Client.new io, @binder.env(sock)
296
- pool << c
295
+ client = Client.new io, @binder.env(sock)
296
+ pool << client
297
297
  end
298
298
  rescue SystemCallError
299
299
  end
@@ -732,8 +732,8 @@ module Puma
732
732
  begin
733
733
  if io = sock.accept_nonblock
734
734
  count += 1
735
- c = Client.new io, @binder.env(sock)
736
- @thread_pool << c
735
+ client = Client.new io, @binder.env(sock)
736
+ @thread_pool << client
737
737
  end
738
738
  rescue SystemCallError
739
739
  end
@@ -31,7 +31,7 @@ You can add an instance by editing the file or running the following command:
31
31
  The config and log paths are optional parameters and default to:
32
32
 
33
33
  * config: /path/to/app/*config/puma.rb*
34
- * log: /path/to/app/*config/puma.log*
34
+ * log: /path/to/app/*log/puma.log*
35
35
 
36
36
  To remove an app, simply delete the line from the config file or run:
37
37
 
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: 2.8.1
4
+ version: 2.8.2
5
5
  platform: java
6
6
  authors:
7
7
  - Evan Phoenix
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-06 00:00:00.000000000 Z
11
+ date: 2014-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -64,12 +64,12 @@ dependencies:
64
64
  requirements:
65
65
  - - ~>
66
66
  - !ruby/object:Gem::Version
67
- version: '3.9'
67
+ version: '3.11'
68
68
  requirement: !ruby/object:Gem::Requirement
69
69
  requirements:
70
70
  - - ~>
71
71
  - !ruby/object:Gem::Version
72
- version: '3.9'
72
+ version: '3.11'
73
73
  prerelease: false
74
74
  type: :development
75
75
  description: Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server for Ruby/Rack applications. Puma is intended for use in both development and production environments. In order to get the best throughput, it is highly recommended that you use a Ruby implementation with real threads like Rubinius or JRuby.
@@ -140,6 +140,7 @@ files:
140
140
  - lib/puma/jruby_restart.rb
141
141
  - lib/puma/minissl.rb
142
142
  - lib/puma/null_io.rb
143
+ - lib/puma/puma_http11.jar
143
144
  - lib/puma/rack_default.rb
144
145
  - lib/puma/rack_patch.rb
145
146
  - lib/puma/reactor.rb
@@ -151,14 +152,6 @@ files:
151
152
  - lib/puma/util.rb
152
153
  - lib/rack/handler/puma.rb
153
154
  - puma.gemspec
154
- - tools/jungle/README.md
155
- - tools/jungle/init.d/README.md
156
- - tools/jungle/init.d/puma
157
- - tools/jungle/init.d/run-puma
158
- - tools/jungle/upstart/README.md
159
- - tools/jungle/upstart/puma-manager.conf
160
- - tools/jungle/upstart/puma.conf
161
- - tools/trickletest.rb
162
155
  - test/test_app_status.rb
163
156
  - test/test_cli.rb
164
157
  - test/test_config.rb
@@ -176,7 +169,14 @@ files:
176
169
  - test/test_thread_pool.rb
177
170
  - test/test_unix_socket.rb
178
171
  - test/test_ws.rb
179
- - lib/puma/puma_http11.jar
172
+ - tools/jungle/README.md
173
+ - tools/jungle/init.d/README.md
174
+ - tools/jungle/init.d/puma
175
+ - tools/jungle/init.d/run-puma
176
+ - tools/jungle/upstart/README.md
177
+ - tools/jungle/upstart/puma-manager.conf
178
+ - tools/jungle/upstart/puma.conf
179
+ - tools/trickletest.rb
180
180
  homepage: http://puma.io
181
181
  licenses:
182
182
  - BSD
@@ -198,8 +198,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
198
198
  - !ruby/object:Gem::Version
199
199
  version: '0'
200
200
  requirements: []
201
- rubyforge_project: puma
202
- rubygems_version: 2.1.9
201
+ rubyforge_project:
202
+ rubygems_version: 2.2.1
203
203
  signing_key:
204
204
  specification_version: 4
205
205
  summary: Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server for Ruby/Rack applications