rainbows 1.0.0pre1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.manifest +1 -0
- data/ChangeLog +68 -1
- data/GIT-VERSION-FILE +1 -1
- data/GIT-VERSION-GEN +1 -1
- data/NEWS +18 -0
- data/Rakefile +7 -3
- data/lib/rainbows/const.rb +1 -1
- data/lib/rainbows/ev_core.rb +4 -3
- data/lib/rainbows/event_machine.rb +0 -1
- data/lib/rainbows/http_server.rb +18 -8
- data/lib/rainbows/never_block.rb +5 -2
- data/lib/rainbows/rev/client.rb +1 -2
- data/lib/rainbows/rev/thread.rb +0 -1
- data/rainbows.gemspec +1 -1
- data/t/t0013-reload-bad-config.sh +2 -6
- data/t/t0014-config-conflict.sh +2 -6
- data/t/t0018-reload-restore-settings.sh +53 -0
- data/t/test-lib.sh +25 -0
- data/t/test_isolate.rb +1 -1
- metadata +13 -14
data/.manifest
CHANGED
@@ -164,6 +164,7 @@ t/t0015-working_directory.sh
|
|
164
164
|
t/t0016-onenine-encoding-is-tricky.sh
|
165
165
|
t/t0016.rb
|
166
166
|
t/t0017-keepalive-timeout-zero.sh
|
167
|
+
t/t0018-reload-restore-settings.sh
|
167
168
|
t/t0020-large-sendfile-response.sh
|
168
169
|
t/t0021-sendfile-wrap-to_path.sh
|
169
170
|
t/t0022-copy_stream-byte-range.sh
|
data/ChangeLog
CHANGED
@@ -1,5 +1,72 @@
|
|
1
|
-
ChangeLog from git://git.bogomips.org/rainbows.git (v0.97.0..v1.0.
|
1
|
+
ChangeLog from git://git.bogomips.org/rainbows.git (v0.97.0..v1.0.0)
|
2
2
|
|
3
|
+
commit 9f185041fb7af4cda21ba2d547fd4d16d9b2e453
|
4
|
+
Author: Eric Wong <normalperson@yhbt.net>
|
5
|
+
Date: Thu Oct 28 08:42:09 2010 +0000
|
6
|
+
|
7
|
+
Rainbows! 1.0.0 - internal cleanups
|
8
|
+
|
9
|
+
This release is merely a milestone in our evolving internal API.
|
10
|
+
Use of kgio may result in performance improvements under Ruby
|
11
|
+
1.9.2 with non-blocking I/O-intensive workloads.
|
12
|
+
|
13
|
+
The only bugfix is that SIGHUP reloads restores defaults on
|
14
|
+
unset settings. A similar fix is included in Unicorn 2.0.0
|
15
|
+
as well.
|
16
|
+
|
17
|
+
commit 015635f877084cc05a9e6e4c1430c70279d0a04e
|
18
|
+
Author: Eric Wong <normalperson@yhbt.net>
|
19
|
+
Date: Thu Oct 28 08:40:12 2010 +0000
|
20
|
+
|
21
|
+
tests: avoid race conditions on reload tests
|
22
|
+
|
23
|
+
We need to ensure the old worker is really dead before sending
|
24
|
+
requests after reloading.
|
25
|
+
|
26
|
+
commit b06c6b3ac214bc598d499c994884113d5b106e90
|
27
|
+
Author: Eric Wong <normalperson@yhbt.net>
|
28
|
+
Date: Thu Oct 28 08:29:53 2010 +0000
|
29
|
+
|
30
|
+
t0018: wait for old worker to be reaped
|
31
|
+
|
32
|
+
On busy machines, old workers may not shutdown quickly
|
33
|
+
enough and may still be processing requests.
|
34
|
+
|
35
|
+
commit f84f138233be0607b0151a5a28c3f9190ba336a2
|
36
|
+
Author: Eric Wong <normalperson@yhbt.net>
|
37
|
+
Date: Thu Oct 28 08:20:37 2010 +0000
|
38
|
+
|
39
|
+
rev+event_machine: small cleanups with new parser API
|
40
|
+
|
41
|
+
These allow for small reductions in the amount of variables
|
42
|
+
we have to manage, more changes coming with later Unicorns.
|
43
|
+
|
44
|
+
commit c4579db76b9ed5b0286fad852e798e8a890f093c
|
45
|
+
Author: Eric Wong <normalperson@yhbt.net>
|
46
|
+
Date: Thu Oct 28 02:17:25 2010 +0000
|
47
|
+
|
48
|
+
HUP reload restores defaults on unset settings
|
49
|
+
|
50
|
+
For consistency, changed settings are reset back to
|
51
|
+
their default values if they are removed or commented
|
52
|
+
out from the config file.
|
53
|
+
|
54
|
+
commit 83644e02068311c7ff9cdbc63efd4764d1518138
|
55
|
+
Author: Eric Wong <normalperson@yhbt.net>
|
56
|
+
Date: Wed Oct 27 23:52:28 2010 +0000
|
57
|
+
|
58
|
+
use Unicorn 2.0.0 final
|
59
|
+
|
60
|
+
Unicorn 2.0.0 has CPU wakeup reductions.
|
61
|
+
|
62
|
+
commit 2b9503566759678c9fbd7b01d1b5f487854208db
|
63
|
+
Author: Eric Wong <normalperson@yhbt.net>
|
64
|
+
Date: Tue Oct 26 21:36:02 2010 +0000
|
65
|
+
|
66
|
+
Rakefile: updates for prereleases
|
67
|
+
|
68
|
+
We do prereleases, now.
|
69
|
+
|
3
70
|
commit a47cd4a7f392a76357ed4f3e458797ae1f9c8f25
|
4
71
|
Author: Eric Wong <normalperson@yhbt.net>
|
5
72
|
Date: Tue Oct 26 21:26:03 2010 +0000
|
data/GIT-VERSION-FILE
CHANGED
@@ -1 +1 @@
|
|
1
|
-
GIT_VERSION = 1.0.
|
1
|
+
GIT_VERSION = 1.0.0
|
data/GIT-VERSION-GEN
CHANGED
data/NEWS
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
=== 1.0.0 / 2010-10-28 09:01 UTC
|
2
|
+
|
3
|
+
This release is merely a milestone in our evolving internal API.
|
4
|
+
Use of kgio may result in performance improvements under Ruby
|
5
|
+
1.9.2 with non-blocking I/O-intensive workloads.
|
6
|
+
|
7
|
+
The only bugfix is that SIGHUP reloads restores defaults on
|
8
|
+
unset settings. A similar fix is included in Unicorn 2.0.0
|
9
|
+
as well.
|
10
|
+
|
11
|
+
=== 1.0.0pre1 / 2010-10-26 21:33 UTC
|
12
|
+
|
13
|
+
Mostly internal changes for kgio (and Unicorn) integration.
|
14
|
+
There should be no (supported) user-visible changes from
|
15
|
+
Rainbows! 0.97.0. kgio should improve performance for
|
16
|
+
concurrency models that use non-blocking I/O internally,
|
17
|
+
especially under Ruby 1.9.2
|
18
|
+
|
1
19
|
=== 0.97.0 / 2010-08-28 19:46 UTC
|
2
20
|
|
3
21
|
We now depend on Unicorn 1.1.3 to avoid race conditions during
|
data/Rakefile
CHANGED
@@ -7,7 +7,7 @@ autoload :Tempfile, 'tempfile'
|
|
7
7
|
def tags
|
8
8
|
timefmt = '%Y-%m-%dT%H:%M:%SZ'
|
9
9
|
@tags ||= `git tag -l`.split(/\n/).map do |tag|
|
10
|
-
if %r{\Av[\d\.]
|
10
|
+
if %r{\Av[\d\.]+} =~ tag
|
11
11
|
header, subject, body = `git cat-file tag #{tag}`.split(/\n\n/, 3)
|
12
12
|
header = header.split(/\n/)
|
13
13
|
tagger = header.grep(/\Atagger /).first
|
@@ -192,7 +192,11 @@ task :fm_update do
|
|
192
192
|
"changelog" => changelog,
|
193
193
|
},
|
194
194
|
}.to_json
|
195
|
-
|
196
|
-
|
195
|
+
if ! changelog.strip.empty? && version =~ %r{\A[\d\.]+\d+\z}
|
196
|
+
Net::HTTP.start(uri.host, uri.port) do |http|
|
197
|
+
p http.post(uri.path, req, {'Content-Type'=>'application/json'})
|
198
|
+
end
|
199
|
+
else
|
200
|
+
warn "not updating freshmeat for v#{version}"
|
197
201
|
end
|
198
202
|
end
|
data/lib/rainbows/const.rb
CHANGED
data/lib/rainbows/ev_core.rb
CHANGED
@@ -14,10 +14,10 @@ module Rainbows::EvCore
|
|
14
14
|
ASYNC_CLOSE = "async.close".freeze
|
15
15
|
|
16
16
|
def post_init
|
17
|
-
@env = {}
|
18
17
|
@hp = HttpParser.new
|
18
|
+
@env = @hp.env
|
19
|
+
@buf = @hp.buf
|
19
20
|
@state = :headers # [ :body [ :trailers ] ] :app_call :close
|
20
|
-
@buf = ""
|
21
21
|
end
|
22
22
|
|
23
23
|
# graceful exit, like SIGQUIT
|
@@ -47,7 +47,8 @@ module Rainbows::EvCore
|
|
47
47
|
def on_read(data)
|
48
48
|
case @state
|
49
49
|
when :headers
|
50
|
-
@
|
50
|
+
@buf << data
|
51
|
+
@hp.parse or return
|
51
52
|
@state = :body
|
52
53
|
len = @hp.content_length
|
53
54
|
if len == 0
|
data/lib/rainbows/http_server.rb
CHANGED
@@ -24,8 +24,6 @@ class Rainbows::HttpServer < Unicorn::HttpServer
|
|
24
24
|
G.quit! # let the master reopen and refork us
|
25
25
|
end
|
26
26
|
|
27
|
-
#:stopdoc:
|
28
|
-
#
|
29
27
|
# Add one second to the timeout since our fchmod heartbeat is less
|
30
28
|
# precise (and must be more conservative) than Unicorn does. We
|
31
29
|
# handle many clients per process and can't chmod on every
|
@@ -35,7 +33,23 @@ class Rainbows::HttpServer < Unicorn::HttpServer
|
|
35
33
|
def timeout=(nr)
|
36
34
|
@timeout = nr + 1
|
37
35
|
end
|
38
|
-
|
36
|
+
|
37
|
+
def load_config!
|
38
|
+
use :Base
|
39
|
+
G.kato = 5
|
40
|
+
Rainbows.max_bytes = 1024 * 1024
|
41
|
+
@worker_connections = nil
|
42
|
+
super
|
43
|
+
@worker_connections ||= Rainbows::MODEL_WORKER_CONNECTIONS[@use]
|
44
|
+
end
|
45
|
+
|
46
|
+
def ready_pipe=(v)
|
47
|
+
# hacky hook got force Rainbows! to load modules only in workers
|
48
|
+
if @master_pid && @master_pid == Process.ppid
|
49
|
+
extend(Rainbows.const_get(@use))
|
50
|
+
end
|
51
|
+
super
|
52
|
+
end
|
39
53
|
|
40
54
|
def use(*args)
|
41
55
|
model = args.shift or return @use
|
@@ -49,7 +63,6 @@ class Rainbows::HttpServer < Unicorn::HttpServer
|
|
49
63
|
|
50
64
|
Module === mod or
|
51
65
|
raise ArgumentError, "concurrency model #{model.inspect} not supported"
|
52
|
-
extend(mod)
|
53
66
|
args.each do |opt|
|
54
67
|
case opt
|
55
68
|
when Hash; O.update(opt)
|
@@ -61,11 +74,8 @@ class Rainbows::HttpServer < Unicorn::HttpServer
|
|
61
74
|
new_defaults = {
|
62
75
|
'rainbows.model' => (@use = model.to_sym),
|
63
76
|
'rack.multithread' => !!(model.to_s =~ /Thread/),
|
77
|
+
'rainbows.autochunk' => [:Rev,:EventMachine,:NeverBlock].include?(@use),
|
64
78
|
}
|
65
|
-
case @use
|
66
|
-
when :Rev, :EventMachine, :NeverBlock
|
67
|
-
new_defaults['rainbows.autochunk'] = true
|
68
|
-
end
|
69
79
|
Rainbows::Const::RACK_DEFAULTS.update(new_defaults)
|
70
80
|
end
|
71
81
|
|
data/lib/rainbows/never_block.rb
CHANGED
@@ -31,8 +31,11 @@ module Rainbows
|
|
31
31
|
raise ArgumentError, "pool_size must a be an Integer > 0"
|
32
32
|
mod = Rainbows.const_get(O[:backend])
|
33
33
|
require "never_block" # require EM first since we need a higher version
|
34
|
-
|
35
|
-
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.extended(klass)
|
37
|
+
klass.extend(Rainbows.const_get(O[:backend])) # EventMachine
|
38
|
+
klass.extend(Core)
|
36
39
|
end
|
37
40
|
|
38
41
|
module Core # :nodoc: all
|
data/lib/rainbows/rev/client.rb
CHANGED
@@ -109,7 +109,6 @@ module Rainbows
|
|
109
109
|
|
110
110
|
rev_write_response(response, alive = @hp.keepalive? && G.alive)
|
111
111
|
return quit unless alive && :close != @state
|
112
|
-
@env.clear
|
113
112
|
@hp.reset
|
114
113
|
@state = :headers
|
115
114
|
disable if enabled?
|
@@ -131,7 +130,7 @@ module Rainbows
|
|
131
130
|
when :close
|
132
131
|
close if @_write_buffer.empty?
|
133
132
|
when :headers
|
134
|
-
if @hp.
|
133
|
+
if @hp.parse
|
135
134
|
app_call
|
136
135
|
else
|
137
136
|
unless enabled?
|
data/lib/rainbows/rev/thread.rb
CHANGED
data/rainbows.gemspec
CHANGED
@@ -44,7 +44,7 @@ Gem::Specification.new do |s|
|
|
44
44
|
s.add_dependency(%q<rack>, ['~> 1.1'])
|
45
45
|
|
46
46
|
# we need Unicorn for the HTTP parser and process management
|
47
|
-
s.add_dependency(%q<unicorn>, ["~> 2.0.
|
47
|
+
s.add_dependency(%q<unicorn>, ["~> 2.0.0"])
|
48
48
|
s.add_development_dependency(%q<isolate>, "~> 3.0.0")
|
49
49
|
|
50
50
|
# optional runtime dependencies depending on configuration
|
@@ -29,12 +29,8 @@ t_begin "introduce syntax error in rackup file" && {
|
|
29
29
|
t_begin "reload signal succeeds" && {
|
30
30
|
kill -HUP $rainbows_pid
|
31
31
|
rainbows_wait_start
|
32
|
-
|
33
|
-
|
34
|
-
sleep 1
|
35
|
-
done
|
36
|
-
|
37
|
-
grep 'error reloading' $r_err >/dev/null
|
32
|
+
wait_for_reload $r_err error
|
33
|
+
wait_for_reap
|
38
34
|
> $r_err
|
39
35
|
}
|
40
36
|
|
data/t/t0014-config-conflict.sh
CHANGED
@@ -30,12 +30,8 @@ t_begin "modify rackup file" && {
|
|
30
30
|
t_begin "reload signal succeeds" && {
|
31
31
|
kill -HUP $rainbows_pid
|
32
32
|
rainbows_wait_start
|
33
|
-
|
34
|
-
|
35
|
-
sleep 1
|
36
|
-
done
|
37
|
-
|
38
|
-
grep 'done reloading' $r_err >/dev/null
|
33
|
+
wait_for_reload
|
34
|
+
wait_for_reap
|
39
35
|
}
|
40
36
|
|
41
37
|
t_begin "hit with curl" && {
|
@@ -0,0 +1,53 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
. ./test-lib.sh
|
3
|
+
t_plan 8 "reload restore settings for $model"
|
4
|
+
|
5
|
+
t_begin "setup and start" && {
|
6
|
+
rtmpfiles orig_config
|
7
|
+
rainbows_setup
|
8
|
+
cat $unicorn_config > $orig_config
|
9
|
+
rainbows -D -c $unicorn_config -l $listen env.ru
|
10
|
+
rainbows_wait_start
|
11
|
+
}
|
12
|
+
|
13
|
+
t_begin "HTTP request confirms we're running the correct model" && {
|
14
|
+
curl -sSfv http://$listen/ | grep "\"rainbows.model\"=>:$model"
|
15
|
+
}
|
16
|
+
|
17
|
+
t_begin "clobber config and reload" && {
|
18
|
+
cat > $unicorn_config <<EOF
|
19
|
+
stderr_path "$r_err"
|
20
|
+
EOF
|
21
|
+
kill -HUP $rainbows_pid
|
22
|
+
wait_for_reload
|
23
|
+
wait_for_reap
|
24
|
+
}
|
25
|
+
|
26
|
+
t_begin "HTTP request confirms we're on the default model" && {
|
27
|
+
curl -sSfv http://$listen/ | \
|
28
|
+
grep "\"rainbows.model\"=>:Base" >/dev/null
|
29
|
+
}
|
30
|
+
|
31
|
+
t_begin "restore config and reload" && {
|
32
|
+
cat $orig_config > $unicorn_config
|
33
|
+
> $r_err
|
34
|
+
kill -HUP $rainbows_pid
|
35
|
+
rainbows_wait_start
|
36
|
+
wait_for_reload
|
37
|
+
wait_for_reap
|
38
|
+
}
|
39
|
+
|
40
|
+
t_begin "HTTP request confirms we're back on the correct model" && {
|
41
|
+
curl -sSfv http://$listen/ | \
|
42
|
+
grep "\"rainbows.model\"=>:$model" >/dev/null
|
43
|
+
}
|
44
|
+
|
45
|
+
t_begin "killing succeeds" && {
|
46
|
+
kill $rainbows_pid
|
47
|
+
}
|
48
|
+
|
49
|
+
t_begin "check stderr" && {
|
50
|
+
check_stderr
|
51
|
+
}
|
52
|
+
|
53
|
+
t_done
|
data/t/test-lib.sh
CHANGED
@@ -148,6 +148,31 @@ rainbows_wait_start () {
|
|
148
148
|
rainbows_pid=$(cat $pid)
|
149
149
|
}
|
150
150
|
|
151
|
+
wait_for_reload () {
|
152
|
+
case $# in
|
153
|
+
0) err_log=$r_err status=done ;;
|
154
|
+
1) err_log=$1 status=done ;;
|
155
|
+
2) err_log=$1 status=$2 ;;
|
156
|
+
esac
|
157
|
+
while ! egrep '(done|error) reloading' < $err_log >/dev/null
|
158
|
+
do
|
159
|
+
sleep 1
|
160
|
+
done
|
161
|
+
grep "$status reloading" $err_log >/dev/null
|
162
|
+
}
|
163
|
+
|
164
|
+
wait_for_reap () {
|
165
|
+
case $# in
|
166
|
+
0) err_log=$r_err ;;
|
167
|
+
1) err_log=$1 ;;
|
168
|
+
esac
|
169
|
+
|
170
|
+
while ! grep reaped < $err_log >/dev/null
|
171
|
+
do
|
172
|
+
sleep 1
|
173
|
+
done
|
174
|
+
}
|
175
|
+
|
151
176
|
rsha1 () {
|
152
177
|
_cmd="$(which sha1sum 2>/dev/null || :)"
|
153
178
|
test -n "$_cmd" || _cmd="$(which openssl 2>/dev/null || :) sha1"
|
data/t/test_isolate.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rainbows
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 23
|
5
|
+
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 0
|
10
|
+
version: 1.0.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Rainbows! hackers
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-10-
|
18
|
+
date: 2010-10-28 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -41,12 +41,12 @@ dependencies:
|
|
41
41
|
requirements:
|
42
42
|
- - ~>
|
43
43
|
- !ruby/object:Gem::Version
|
44
|
-
hash:
|
44
|
+
hash: 15
|
45
45
|
segments:
|
46
46
|
- 2
|
47
47
|
- 0
|
48
|
-
-
|
49
|
-
version: 2.0.
|
48
|
+
- 0
|
49
|
+
version: 2.0.0
|
50
50
|
type: :runtime
|
51
51
|
version_requirements: *id002
|
52
52
|
- !ruby/object:Gem::Dependency
|
@@ -321,6 +321,7 @@ files:
|
|
321
321
|
- t/t0016-onenine-encoding-is-tricky.sh
|
322
322
|
- t/t0016.rb
|
323
323
|
- t/t0017-keepalive-timeout-zero.sh
|
324
|
+
- t/t0018-reload-restore-settings.sh
|
324
325
|
- t/t0020-large-sendfile-response.sh
|
325
326
|
- t/t0021-sendfile-wrap-to_path.sh
|
326
327
|
- t/t0022-copy_stream-byte-range.sh
|
@@ -383,14 +384,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
383
384
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
384
385
|
none: false
|
385
386
|
requirements:
|
386
|
-
- - "
|
387
|
+
- - ">="
|
387
388
|
- !ruby/object:Gem::Version
|
388
|
-
hash:
|
389
|
+
hash: 3
|
389
390
|
segments:
|
390
|
-
-
|
391
|
-
|
392
|
-
- 1
|
393
|
-
version: 1.3.1
|
391
|
+
- 0
|
392
|
+
version: "0"
|
394
393
|
requirements: []
|
395
394
|
|
396
395
|
rubyforge_project: rainbows
|