puma 2.11.3-java → 2.12.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.

@@ -2,8 +2,7 @@ require 'test/unit'
2
2
  require 'puma'
3
3
  require 'rack/lint'
4
4
  require 'test/testhelp'
5
- require 'rack/commonlogger'
6
- require 'puma/rack_patch'
5
+ require 'puma/commonlogger'
7
6
 
8
7
  class TestRackServer < Test::Unit::TestCase
9
8
 
@@ -179,4 +179,51 @@ class TestThreadPool < Test::Unit::TestCase
179
179
 
180
180
  assert_equal [], values.compact
181
181
  end
182
+
183
+ def test_reap_only_dead_threads
184
+ pool = new_pool(2,2) { Thread.current.kill }
185
+
186
+ assert_equal 2, pool.spawned
187
+
188
+ pool << 1
189
+
190
+ pause
191
+
192
+ assert_equal 2, pool.spawned
193
+
194
+ pool.reap
195
+
196
+ assert_equal 1, pool.spawned
197
+
198
+ pool << 2
199
+
200
+ pause
201
+
202
+ assert_equal 1, pool.spawned
203
+
204
+ pool.reap
205
+
206
+ assert_equal 0, pool.spawned
207
+ end
208
+
209
+ def test_auto_reap_dead_threads
210
+ pool = new_pool(2,2) { Thread.current.kill }
211
+
212
+ assert_equal 2, pool.spawned
213
+
214
+ pool << 1
215
+ pool << 2
216
+
217
+ pause
218
+
219
+ assert_equal 2, pool.spawned
220
+
221
+ pool.auto_reap! 1
222
+
223
+ sleep 1
224
+
225
+ pause
226
+
227
+ assert_equal 0, pool.spawned
228
+ end
182
229
  end
@@ -34,11 +34,17 @@ script
34
34
  # respawn as bash so we can source in rbenv/rvm
35
35
  # quoted heredoc to tell /bin/sh not to interpret
36
36
  # variables
37
+
38
+ # source ENV variables manually as Upstart doesn't, eg:
39
+ #. /etc/environment
40
+
37
41
  exec /bin/bash <<'EOT'
38
42
  # set HOME to the setuid user's home, there doesn't seem to be a better, portable way
39
43
  export HOME="$(eval echo ~$(id -un))"
40
44
 
41
- if [ -d "$HOME/.rbenv/bin" ]; then
45
+ if [ -d "/usr/local/rbenv/bin" ]; then
46
+ export PATH="/usr/local/rbenv/bin:/usr/local/rbenv/shims:$PATH"
47
+ elif [ -d "$HOME/.rbenv/bin" ]; then
42
48
  export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH"
43
49
  elif [ -f /etc/profile.d/rvm.sh ]; then
44
50
  source /etc/profile.d/rvm.sh
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puma
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.11.3
4
+ version: 2.12.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: 2015-05-19 00:00:00.000000000 Z
11
+ date: 2015-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ~>
17
+ - !ruby/object:Gem::Version
18
+ version: '4.0'
19
+ name: rdoc
20
+ prerelease: false
21
+ type: :development
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '4.0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  requirement: !ruby/object:Gem::Requirement
15
29
  requirements:
@@ -21,7 +35,7 @@ dependencies:
21
35
  version: '2.0'
22
36
  name: rack
23
37
  prerelease: false
24
- type: :runtime
38
+ type: :development
25
39
  version_requirements: !ruby/object:Gem::Requirement
26
40
  requirements:
27
41
  - - '>='
@@ -30,20 +44,6 @@ dependencies:
30
44
  - - <
31
45
  - !ruby/object:Gem::Version
32
46
  version: '2.0'
33
- - !ruby/object:Gem::Dependency
34
- requirement: !ruby/object:Gem::Requirement
35
- requirements:
36
- - - ~>
37
- - !ruby/object:Gem::Version
38
- version: '4.0'
39
- name: rdoc
40
- prerelease: false
41
- type: :development
42
- version_requirements: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - ~>
45
- - !ruby/object:Gem::Version
46
- version: '4.0'
47
47
  - !ruby/object:Gem::Dependency
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  requirements:
@@ -127,6 +127,7 @@ files:
127
127
  - lib/puma/cli.rb
128
128
  - lib/puma/client.rb
129
129
  - lib/puma/cluster.rb
130
+ - lib/puma/commonlogger.rb
130
131
  - lib/puma/compat.rb
131
132
  - lib/puma/configuration.rb
132
133
  - lib/puma/const.rb
@@ -141,8 +142,11 @@ files:
141
142
  - lib/puma/jruby_restart.rb
142
143
  - lib/puma/minissl.rb
143
144
  - lib/puma/null_io.rb
145
+ - lib/puma/rack/backports/uri/common_18.rb
146
+ - lib/puma/rack/backports/uri/common_192.rb
147
+ - lib/puma/rack/backports/uri/common_193.rb
148
+ - lib/puma/rack/builder.rb
144
149
  - lib/puma/rack_default.rb
145
- - lib/puma/rack_patch.rb
146
150
  - lib/puma/reactor.rb
147
151
  - lib/puma/runner.rb
148
152
  - lib/puma/server.rb
@@ -1,45 +0,0 @@
1
- require 'rack/commonlogger'
2
-
3
- module Rack
4
- # Patch CommonLogger to use after_reply.
5
- #
6
- # Simply request this file and CommonLogger will be a bit more
7
- # efficient.
8
- class CommonLogger
9
- remove_method :call
10
-
11
- def call(env)
12
- began_at = Time.now
13
- status, header, body = @app.call(env)
14
- header = Utils::HeaderHash.new(header)
15
-
16
- # If we've been hijacked, then output a special line
17
- if env['rack.hijack_io']
18
- log_hijacking(env, 'HIJACK', header, began_at)
19
- elsif ary = env['rack.after_reply']
20
- ary << lambda { log(env, status, header, began_at) }
21
- else
22
- body = BodyProxy.new(body) { log(env, status, header, began_at) }
23
- end
24
-
25
- [status, header, body]
26
- end
27
-
28
- HIJACK_FORMAT = %{%s - %s [%s] "%s %s%s %s" HIJACKED -1 %0.4f\n}
29
-
30
- def log_hijacking(env, status, header, began_at)
31
- now = Time.now
32
-
33
- logger = @logger || env['rack.errors']
34
- logger.write HIJACK_FORMAT % [
35
- env['HTTP_X_FORWARDED_FOR'] || env["REMOTE_ADDR"] || "-",
36
- env["REMOTE_USER"] || "-",
37
- now.strftime("%d/%b/%Y %H:%M:%S"),
38
- env["REQUEST_METHOD"],
39
- env["PATH_INFO"],
40
- env["QUERY_STRING"].empty? ? "" : "?"+env["QUERY_STRING"],
41
- env["HTTP_VERSION"],
42
- now - began_at ]
43
- end
44
- end
45
- end