puma 1.6.2-java → 1.6.3-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.
- data/History.txt +6 -0
- data/lib/puma/cli.rb +3 -2
- data/lib/puma/const.rb +1 -1
- data/lib/puma/events.rb +3 -0
- data/lib/puma/puma_http11.jar +0 -0
- data/lib/puma/reactor.rb +15 -0
- data/lib/puma/server.rb +2 -0
- data/puma.gemspec +2 -2
- data/test/test_integration.rb +49 -0
- metadata +2 -2
data/History.txt
CHANGED
data/lib/puma/cli.rb
CHANGED
@@ -325,12 +325,13 @@ module Puma
|
|
325
325
|
|
326
326
|
@listeners << [str, io]
|
327
327
|
when "unix"
|
328
|
+
path = "#{uri.host}#{uri.path}"
|
329
|
+
|
328
330
|
if fd = @inherited_fds.delete(str)
|
329
331
|
log "* Inherited #{str}"
|
330
|
-
io = server.inherit_unix_listener
|
332
|
+
io = server.inherit_unix_listener path, fd
|
331
333
|
else
|
332
334
|
log "* Listening on #{str}"
|
333
|
-
path = "#{uri.host}#{uri.path}"
|
334
335
|
|
335
336
|
umask = nil
|
336
337
|
|
data/lib/puma/const.rb
CHANGED
data/lib/puma/events.rb
CHANGED
data/lib/puma/puma_http11.jar
CHANGED
Binary file
|
data/lib/puma/reactor.rb
CHANGED
@@ -30,6 +30,15 @@ module Puma
|
|
30
30
|
when "*"
|
31
31
|
sockets += @input
|
32
32
|
@input.clear
|
33
|
+
when "c"
|
34
|
+
sockets.delete_if do |s|
|
35
|
+
if s == @ready
|
36
|
+
false
|
37
|
+
else
|
38
|
+
s.close
|
39
|
+
true
|
40
|
+
end
|
41
|
+
end
|
33
42
|
when "!"
|
34
43
|
return
|
35
44
|
end
|
@@ -121,8 +130,14 @@ module Puma
|
|
121
130
|
end
|
122
131
|
end
|
123
132
|
|
133
|
+
# Close all watched sockets and clear them from being watched
|
134
|
+
def clear!
|
135
|
+
@trigger << "c"
|
136
|
+
end
|
137
|
+
|
124
138
|
def shutdown
|
125
139
|
@trigger << "!"
|
140
|
+
@thread.join
|
126
141
|
end
|
127
142
|
end
|
128
143
|
end
|
data/lib/puma/server.rb
CHANGED
data/puma.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "puma"
|
5
|
-
s.version = "1.6.
|
5
|
+
s.version = "1.6.3"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Evan Phoenix"]
|
9
|
-
s.date = "2012-
|
9
|
+
s.date = "2012-09-04"
|
10
10
|
s.description = "Puma is a simple, fast, and highly concurrent HTTP 1.1 server for Ruby web applications. It can be used with any application that supports Rack, and is considered the replacement for Webrick and Mongrel. It was designed to be the go-to server for [Rubinius](http://rubini.us), but also works well with JRuby and MRI. Puma is intended for use in both development and production environments.\n\nUnder the hood, Puma processes requests using a C-optimized Ragel extension (inherited from Mongrel) that provides fast, accurate HTTP 1.1 protocol parsing in a portable way. Puma then serves the request in a thread from an internal thread pool (which you can control). This allows Puma to provide real concurrency for your web application!\n\nWith Rubinius 2.0, Puma will utilize all cores on your CPU with real threads, meaning you won't have to spawn multiple processes to increase throughput. You can expect to see a similar benefit from JRuby.\n\nOn MRI, there is a Global Interpreter Lock (GIL) that ensures only one thread can be run at a time. But if you're doing a lot of blocking IO (such as HTTP calls to external APIs like Twitter), Puma still improves MRI's throughput by allowing blocking IO to be run concurrently (EventMachine-based servers such as Thin turn off this ability, requiring you to use special libraries). Your mileage may vary. In order to get the best throughput, it is highly recommended that you use a Ruby implementation with real threads like [Rubinius](http://rubini.us) or [JRuby](http://jruby.org)."
|
11
11
|
s.email = ["evan@phx.io"]
|
12
12
|
s.executables = ["puma", "pumactl"]
|
data/test/test_integration.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require "rbconfig"
|
2
2
|
require 'test/unit'
|
3
3
|
require 'socket'
|
4
|
+
require 'timeout'
|
5
|
+
require 'net/http'
|
4
6
|
|
5
7
|
require 'puma/cli'
|
6
8
|
require 'puma/control_cli'
|
@@ -10,12 +12,34 @@ class TestIntegration < Test::Unit::TestCase
|
|
10
12
|
@state_path = "test/test_puma.state"
|
11
13
|
@bind_path = "test/test_server.sock"
|
12
14
|
@control_path = "test/test_control.sock"
|
15
|
+
@tcp_port = 9998
|
16
|
+
|
17
|
+
@server = nil
|
13
18
|
end
|
14
19
|
|
15
20
|
def teardown
|
16
21
|
File.unlink @state_path rescue nil
|
17
22
|
File.unlink @bind_path rescue nil
|
18
23
|
File.unlink @control_path rescue nil
|
24
|
+
|
25
|
+
if @server
|
26
|
+
Process.kill "INT", @server.pid
|
27
|
+
Process.wait @server.pid
|
28
|
+
@server.close
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def server(opts)
|
33
|
+
core = "#{Gem.ruby} -rubygems -Ilib bin/puma"
|
34
|
+
cmd = "#{core} --restart-cmd '#{core}' -b tcp://127.0.0.1:#{@tcp_port} #{opts}"
|
35
|
+
@server = IO.popen(cmd, "r")
|
36
|
+
|
37
|
+
sleep 1
|
38
|
+
@server
|
39
|
+
end
|
40
|
+
|
41
|
+
def signal(which)
|
42
|
+
Process.kill which, @server.pid
|
19
43
|
end
|
20
44
|
|
21
45
|
def test_stop_via_pumactl
|
@@ -45,4 +69,29 @@ class TestIntegration < Test::Unit::TestCase
|
|
45
69
|
|
46
70
|
assert_kind_of Thread, t.join(1), "server didn't stop"
|
47
71
|
end
|
72
|
+
|
73
|
+
def test_restart_closes_keepalive_sockets
|
74
|
+
server("-q test/hello.ru")
|
75
|
+
|
76
|
+
s = TCPSocket.new "localhost", @tcp_port
|
77
|
+
s << "GET / HTTP/1.1\r\n\r\n"
|
78
|
+
true until s.gets == "\r\n"
|
79
|
+
|
80
|
+
s.readpartial(20)
|
81
|
+
signal :USR2
|
82
|
+
|
83
|
+
sleep 3
|
84
|
+
|
85
|
+
s.write "GET / HTTP/1.1\r\n\r\n"
|
86
|
+
|
87
|
+
assert_raises Errno::ECONNRESET do
|
88
|
+
Timeout.timeout(2) do
|
89
|
+
s.read(2)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
s = TCPSocket.new "localhost", @tcp_port
|
94
|
+
s << "GET / HTTP/1.0\r\n\r\n"
|
95
|
+
assert_equal "Hello World", s.read.split("\r\n").last
|
96
|
+
end
|
48
97
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: puma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.6.
|
5
|
+
version: 1.6.3
|
6
6
|
platform: java
|
7
7
|
authors:
|
8
8
|
- Evan Phoenix
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-09-04 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rack
|