zbatery 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +14 -186
- data/GIT-VERSION-FILE +1 -1
- data/GIT-VERSION-GEN +1 -1
- data/GNUmakefile +1 -1
- data/NEWS +5 -0
- data/bin/zbatery +24 -31
- data/lib/zbatery.rb +20 -65
- data/t/test_isolate.rb +3 -4
- data/zbatery.gemspec +2 -6
- metadata +10 -18
data/ChangeLog
CHANGED
|
@@ -1,198 +1,26 @@
|
|
|
1
|
-
ChangeLog from git://git.bogomips.org/zbatery.git (v0.
|
|
1
|
+
ChangeLog from git://git.bogomips.org/zbatery.git (v0.3.1..v0.4.0)
|
|
2
2
|
|
|
3
|
-
commit
|
|
3
|
+
commit f3aa4b5c01c9ff7d72c6ce5bfde398d556e15d5a
|
|
4
4
|
Author: Eric Wong <normalperson@yhbt.net>
|
|
5
|
-
Date:
|
|
5
|
+
Date: Thu Oct 28 09:44:45 2010 +0000
|
|
6
6
|
|
|
7
|
-
Zbatery
|
|
7
|
+
Zbatery 0.4.0 - Rainbows! 1.0.x sync
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
Fix documentation generation
|
|
12
|
-
bump Rainbows! (and Unicorn) dependencies
|
|
9
|
+
This release syncs up with the latest from Rainbows! 1.0.x
|
|
10
|
+
and Unicorn 2.0.x
|
|
13
11
|
|
|
14
|
-
commit
|
|
12
|
+
commit 7a01cae820a175c2f7fd85e43f2e06ec8174340d
|
|
15
13
|
Author: Eric Wong <normalperson@yhbt.net>
|
|
16
|
-
Date:
|
|
14
|
+
Date: Thu Oct 28 09:43:15 2010 +0000
|
|
17
15
|
|
|
18
|
-
|
|
16
|
+
updates for Rainbows! 1.0.0
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
with TeeInput
|
|
18
|
+
There are some internal API changes here.
|
|
22
19
|
|
|
23
|
-
commit
|
|
20
|
+
commit c37172c8febcec7f8a491b6e229260ca607e14b0
|
|
24
21
|
Author: Eric Wong <normalperson@yhbt.net>
|
|
25
|
-
Date: Sat
|
|
22
|
+
Date: Sat Aug 28 20:03:57 2010 +0000
|
|
26
23
|
|
|
27
|
-
|
|
24
|
+
bump dependencies on Unicorn + Rainbows!
|
|
28
25
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
commit 35f28b9eeae69077003fc9d98779104d76da5531
|
|
32
|
-
Author: Eric Wong <normalperson@yhbt.net>
|
|
33
|
-
Date: Sat Jul 10 09:58:53 2010 +0000
|
|
34
|
-
|
|
35
|
-
update local.mk.sample for 0.3.0
|
|
36
|
-
|
|
37
|
-
commit d4f095ed8ed0da4f190280eb957c14b3f5e9a2e9
|
|
38
|
-
Author: Eric Wong <normalperson@yhbt.net>
|
|
39
|
-
Date: Sat Jul 10 09:56:27 2010 +0000
|
|
40
|
-
|
|
41
|
-
Zbatery v0.3.0 - for newer Rainbows!
|
|
42
|
-
|
|
43
|
-
Rainbows! v0.95.0 is more awesome than v0.94.0, so we've updated
|
|
44
|
-
ourselves to use it and be more awesome as well!
|
|
45
|
-
|
|
46
|
-
commit 00f570d6c3363794ee4489fae17b05555b78b2cf
|
|
47
|
-
Author: Eric Wong <normalperson@yhbt.net>
|
|
48
|
-
Date: Sat Jul 10 09:55:20 2010 +0000
|
|
49
|
-
|
|
50
|
-
gemspec: small doc updates
|
|
51
|
-
|
|
52
|
-
commit 59d3b3f6318a85e4d68592e1f7b992dd54832aa0
|
|
53
|
-
Author: Eric Wong <normalperson@yhbt.net>
|
|
54
|
-
Date: Sat Jul 10 09:53:52 2010 +0000
|
|
55
|
-
|
|
56
|
-
add additional tests for newish Rainbows! features
|
|
57
|
-
|
|
58
|
-
commit bd6b2263869c271113577b88d526c7c2a6f1455d
|
|
59
|
-
Author: Eric Wong <normalperson@yhbt.net>
|
|
60
|
-
Date: Sat Jul 10 02:41:46 2010 -0700
|
|
61
|
-
|
|
62
|
-
updates for Rainbows! 0.95.0
|
|
63
|
-
|
|
64
|
-
Rainbows! 0.95.0 made some incompatible changes, so update
|
|
65
|
-
everything. Unfortunately we have to avoid subclassing here.
|
|
66
|
-
Tests use isolate now.
|
|
67
|
-
|
|
68
|
-
commit 5764336aa3785af8a08be7ec7b40846ec139eb6c
|
|
69
|
-
Author: Eric Wong <normalperson@yhbt.net>
|
|
70
|
-
Date: Mon Apr 19 14:14:46 2010 -0700
|
|
71
|
-
|
|
72
|
-
Zbatery 0.2.1 - use a less-broken parser from Unicorn
|
|
73
|
-
|
|
74
|
-
This release fixes a denial-of-service vector for deployments
|
|
75
|
-
exposed directly to untrusted clients.
|
|
76
|
-
|
|
77
|
-
The HTTP parser in Unicorn <= 0.97.0 would trip an assertion
|
|
78
|
-
(killing the associated worker process) on invalid
|
|
79
|
-
Content-Length headers instead of raising an exception. Since
|
|
80
|
-
Rainbows! and Zbatery supports multiple clients per worker
|
|
81
|
-
process, all clients connected to the worker process that hit
|
|
82
|
-
the assertion would be aborted.
|
|
83
|
-
|
|
84
|
-
Deployments behind nginx are _not_ affected by this bug, as
|
|
85
|
-
nginx will reject clients that send invalid Content-Length
|
|
86
|
-
headers.
|
|
87
|
-
|
|
88
|
-
The status of deployments behind other HTTP-aware proxies is
|
|
89
|
-
unknown. Deployments behind a non-HTTP-aware proxy (or no proxy
|
|
90
|
-
at all) are certainly affected by this DoS.
|
|
91
|
-
|
|
92
|
-
Users are strongly encouraged to upgrade as soon as possible,
|
|
93
|
-
there are no other changes besides this bug fix from Rainbows!
|
|
94
|
-
0.91.0 nor Unicorn 0.97.0
|
|
95
|
-
|
|
96
|
-
This bug affects all previously released versions of Rainbows!
|
|
97
|
-
and Zbatery.
|
|
98
|
-
|
|
99
|
-
commit bf277616bf1a13385150260c8bccb1d97b830bec
|
|
100
|
-
Author: Eric Wong <normalperson@yhbt.net>
|
|
101
|
-
Date: Mon Mar 1 18:22:14 2010 +0000
|
|
102
|
-
|
|
103
|
-
t0003: fix error log check
|
|
104
|
-
|
|
105
|
-
We don't have "worker" processes in here.
|
|
106
|
-
|
|
107
|
-
commit 816d4e840fca8606215a328beda90dd92153bcd7
|
|
108
|
-
Author: Eric Wong <normalperson@yhbt.net>
|
|
109
|
-
Date: Mon Mar 1 10:40:51 2010 +0000
|
|
110
|
-
|
|
111
|
-
Zbatery 0.2.0 - Unicorn/Rainbows! resync
|
|
112
|
-
|
|
113
|
-
Eric Wong (7):
|
|
114
|
-
use Unicorn.builder to parse config.ru switches
|
|
115
|
-
import selected parts of test suite from Rainbows!
|
|
116
|
-
gemspec: depend on newer Unicorn for Unicorn.builder
|
|
117
|
-
support "user" directive outside of after_fork hook
|
|
118
|
-
MRI 1.8 thread fix to avoid blocking accept()
|
|
119
|
-
disable more Unicorn methods
|
|
120
|
-
support Unicorn 0.96.0+ ready_pipe daemonization
|
|
121
|
-
|
|
122
|
-
commit cdec2a634c85b92aa95d4c1f0ce2a056e332dfca
|
|
123
|
-
Author: Eric Wong <normalperson@yhbt.net>
|
|
124
|
-
Date: Mon Mar 1 10:36:54 2010 +0000
|
|
125
|
-
|
|
126
|
-
support Unicorn 0.96.0+ ready_pipe daemonization
|
|
127
|
-
|
|
128
|
-
ready_pipe allows the controlling process to detect
|
|
129
|
-
errors more reliably.
|
|
130
|
-
|
|
131
|
-
commit 98d605423b3a563de7b2d0b5f37695a4cf5bed7a
|
|
132
|
-
Author: Eric Wong <normalperson@yhbt.net>
|
|
133
|
-
Date: Mon Mar 1 10:33:41 2010 +0000
|
|
134
|
-
|
|
135
|
-
disable more Unicorn methods
|
|
136
|
-
|
|
137
|
-
init_self_pipe! and trap_deferred are worthless and
|
|
138
|
-
possibly harmful to us
|
|
139
|
-
|
|
140
|
-
commit 7dde8d1402a44e2997fa86ff5e3cf89c4ca6d82a
|
|
141
|
-
Author: Eric Wong <normalperson@yhbt.net>
|
|
142
|
-
Date: Mon Mar 1 10:29:01 2010 +0000
|
|
143
|
-
|
|
144
|
-
MRI 1.8 thread fix to avoid blocking accept()
|
|
145
|
-
|
|
146
|
-
Rainbows! commit ee7fe220ccbc991e1e7cbe982caf48e3303274c7
|
|
147
|
-
|
|
148
|
-
Under MRI 1.8, listen sockets do not appear to have the
|
|
149
|
-
nonblocking I/O flag on by default, nor does it set the
|
|
150
|
-
nonblocking I/O flag when calling #accept (but it does
|
|
151
|
-
when using #accept_nonblock, of course).
|
|
152
|
-
|
|
153
|
-
Normally this is not a problem even when using green threads
|
|
154
|
-
since MRI will internally select(2) on the file descriptor
|
|
155
|
-
before attempting a blocking (and immediately successful)
|
|
156
|
-
accept(2).
|
|
157
|
-
|
|
158
|
-
However, when sharing a listen descriptor across multiple
|
|
159
|
-
processes, spurious wakeups are likely to occur, causing
|
|
160
|
-
multiple processes may be woken up when a single client
|
|
161
|
-
connects.
|
|
162
|
-
|
|
163
|
-
This causes a problem because accept(2)-ing on multiple
|
|
164
|
-
threads/processes for a single connection causes blocking accepts in
|
|
165
|
-
multiple processes, leading to stalled green threads.
|
|
166
|
-
|
|
167
|
-
This is not an issue under 1.9 where a blocking accept() call
|
|
168
|
-
unlocks the GVL to let other threads run.
|
|
169
|
-
|
|
170
|
-
commit 168bacbea266baecafe72adc1d7fa08674607744
|
|
171
|
-
Author: Eric Wong <normalperson@yhbt.net>
|
|
172
|
-
Date: Mon Mar 1 10:20:32 2010 +0000
|
|
173
|
-
|
|
174
|
-
support "user" directive outside of after_fork hook
|
|
175
|
-
|
|
176
|
-
This is new in Unicorn 0.97.0, and makes sense to us since we
|
|
177
|
-
don't fork. It won't work as nicely with log reopening in some
|
|
178
|
-
cases, but it's better than nothing
|
|
179
|
-
|
|
180
|
-
commit 796b2db10446ff263e419b1009f854ca6afa4fe4
|
|
181
|
-
Author: Eric Wong <normalperson@yhbt.net>
|
|
182
|
-
Date: Mon Mar 1 09:23:29 2010 +0000
|
|
183
|
-
|
|
184
|
-
gemspec: depend on newer Unicorn for Unicorn.builder
|
|
185
|
-
|
|
186
|
-
commit 9dc37425107195530b30af80ed9aa1ad72c9be94
|
|
187
|
-
Author: Eric Wong <normalperson@yhbt.net>
|
|
188
|
-
Date: Mon Mar 1 08:27:36 2010 +0000
|
|
189
|
-
|
|
190
|
-
import selected parts of test suite from Rainbows!
|
|
191
|
-
|
|
192
|
-
commit 5682d2879258f3ca06b28d4a1a7671b20f676dac
|
|
193
|
-
Author: Eric Wong <normalperson@yhbt.net>
|
|
194
|
-
Date: Sun Feb 28 19:43:06 2010 -0800
|
|
195
|
-
|
|
196
|
-
use Unicorn.builder to parse config.ru switches
|
|
197
|
-
|
|
198
|
-
Less code to maintain this way.
|
|
26
|
+
Small fixes from both that are worth having to ease support.
|
data/GIT-VERSION-FILE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
GIT_VERSION = 0.
|
|
1
|
+
GIT_VERSION = 0.4.0
|
data/GIT-VERSION-GEN
CHANGED
data/GNUmakefile
CHANGED
data/NEWS
CHANGED
data/bin/zbatery
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
#!/
|
|
1
|
+
#!/this/will/be/overwritten/or/wrapped/anyways/do/not/worry/ruby
|
|
2
2
|
# -*- encoding: binary -*-
|
|
3
3
|
require 'unicorn/launcher'
|
|
4
4
|
require 'zbatery'
|
|
5
5
|
require 'optparse'
|
|
6
6
|
|
|
7
7
|
ENV["RACK_ENV"] ||= "development"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
options = { :listeners => listeners }
|
|
11
|
-
host, port = Unicorn::Const::DEFAULT_HOST, Unicorn::Const::DEFAULT_PORT
|
|
12
|
-
set_listener = false
|
|
8
|
+
rackup_opts = Unicorn::Configurator::RACKUP
|
|
9
|
+
options = rackup_opts[:options]
|
|
13
10
|
|
|
14
11
|
opts = OptionParser.new("", 24, ' ') do |opts|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
cmd = File.basename($0)
|
|
13
|
+
opts.banner = "Usage: #{cmd} " \
|
|
14
|
+
"[ruby options] [#{cmd} options] [rackup config file]"
|
|
18
15
|
opts.separator "Ruby options:"
|
|
19
16
|
|
|
20
17
|
lineno = 1
|
|
@@ -41,34 +38,34 @@ opts = OptionParser.new("", 24, ' ') do |opts|
|
|
|
41
38
|
require library
|
|
42
39
|
end
|
|
43
40
|
|
|
44
|
-
opts.separator "
|
|
41
|
+
opts.separator "#{cmd} options:"
|
|
45
42
|
|
|
46
43
|
# some of these switches exist for rackup command-line compatibility,
|
|
47
44
|
|
|
48
45
|
opts.on("-o", "--host HOST",
|
|
49
46
|
"listen on HOST (default: #{Unicorn::Const::DEFAULT_HOST})") do |h|
|
|
50
|
-
host = h
|
|
51
|
-
set_listener = true
|
|
47
|
+
rackup_opts[:host] = h
|
|
48
|
+
rackup_opts[:set_listener] = true
|
|
52
49
|
end
|
|
53
50
|
|
|
54
51
|
opts.on("-p", "--port PORT",
|
|
55
52
|
"use PORT (default: #{Unicorn::Const::DEFAULT_PORT})") do |p|
|
|
56
|
-
port = p.to_i
|
|
57
|
-
set_listener = true
|
|
53
|
+
rackup_opts[:port] = p.to_i
|
|
54
|
+
rackup_opts[:set_listener] = true
|
|
58
55
|
end
|
|
59
56
|
|
|
60
|
-
opts.on("-E", "--env
|
|
61
|
-
"use
|
|
57
|
+
opts.on("-E", "--env RACK_ENV",
|
|
58
|
+
"use RACK_ENV for defaults (default: development)") do |e|
|
|
62
59
|
ENV["RACK_ENV"] = e
|
|
63
60
|
end
|
|
64
61
|
|
|
65
62
|
opts.on("-D", "--daemonize", "run daemonized in the background") do |d|
|
|
66
|
-
daemonize = d
|
|
63
|
+
rackup_opts[:daemonize] = !!d
|
|
67
64
|
end
|
|
68
65
|
|
|
69
66
|
opts.on("-P", "--pid FILE", "DEPRECATED") do |f|
|
|
70
|
-
warn
|
|
71
|
-
warn
|
|
67
|
+
warn "Use of --pid/-P is strongly discouraged"
|
|
68
|
+
warn "Use the 'pid' directive in the Zbatery config file instead"
|
|
72
69
|
options[:pid] = f
|
|
73
70
|
end
|
|
74
71
|
|
|
@@ -77,15 +74,15 @@ opts = OptionParser.new("", 24, ' ') do |opts|
|
|
|
77
74
|
warn "-s/--server only exists for compatibility with rackup"
|
|
78
75
|
end
|
|
79
76
|
|
|
80
|
-
#
|
|
77
|
+
# Rainbows!/Unicorn-specific stuff
|
|
81
78
|
opts.on("-l", "--listen {HOST:PORT|PATH}",
|
|
82
79
|
"listen on HOST:PORT or PATH",
|
|
83
80
|
"this may be specified multiple times",
|
|
84
81
|
"(default: #{Unicorn::Const::DEFAULT_LISTEN})") do |address|
|
|
85
|
-
listeners << address
|
|
82
|
+
options[:listeners] << address
|
|
86
83
|
end
|
|
87
84
|
|
|
88
|
-
opts.on("-c", "--config-file FILE", "
|
|
85
|
+
opts.on("-c", "--config-file FILE", "Zbatery-specific config file") do |f|
|
|
89
86
|
options[:config_file] = f
|
|
90
87
|
end
|
|
91
88
|
|
|
@@ -102,27 +99,23 @@ opts = OptionParser.new("", 24, ' ') do |opts|
|
|
|
102
99
|
end
|
|
103
100
|
|
|
104
101
|
opts.on_tail("-v", "--version", "Show version") do
|
|
105
|
-
puts "
|
|
102
|
+
puts "Zbatery v#{Zbatery::VERSION}"
|
|
106
103
|
exit
|
|
107
104
|
end
|
|
108
105
|
|
|
109
106
|
opts.parse! ARGV
|
|
110
107
|
end
|
|
111
108
|
|
|
112
|
-
|
|
113
|
-
abort "configuration file #{config} not found" unless File.exist?(config)
|
|
114
|
-
|
|
115
|
-
app = Unicorn.builder(config, opts)
|
|
116
|
-
listeners << "#{host}:#{port}" if set_listener
|
|
109
|
+
app = Unicorn.builder(ARGV[0] || 'config.ru', opts)
|
|
117
110
|
|
|
118
111
|
if $DEBUG
|
|
119
112
|
require 'pp'
|
|
120
113
|
pp({
|
|
121
|
-
:
|
|
114
|
+
:unicorn_options => options,
|
|
122
115
|
:app => app,
|
|
123
|
-
:daemonize => daemonize,
|
|
116
|
+
:daemonize => rackup_opts[:daemonize],
|
|
124
117
|
})
|
|
125
118
|
end
|
|
126
119
|
|
|
127
|
-
Unicorn::Launcher.daemonize!(options) if daemonize
|
|
120
|
+
Unicorn::Launcher.daemonize!(options) if rackup_opts[:daemonize]
|
|
128
121
|
Zbatery.run(app, options)
|
data/lib/zbatery.rb
CHANGED
|
@@ -4,8 +4,8 @@ require 'rainbows'
|
|
|
4
4
|
|
|
5
5
|
module Zbatery
|
|
6
6
|
|
|
7
|
-
#
|
|
8
|
-
VERSION = "0.
|
|
7
|
+
# version of Zbatery, currently 0.4.0
|
|
8
|
+
VERSION = "0.4.0"
|
|
9
9
|
|
|
10
10
|
class << self
|
|
11
11
|
|
|
@@ -18,21 +18,10 @@ module Zbatery
|
|
|
18
18
|
|
|
19
19
|
Rainbows::Const::RACK_DEFAULTS["SERVER_SOFTWARE"] = "Zbatery #{VERSION}"
|
|
20
20
|
|
|
21
|
-
# true if our Ruby implementation supports unlinked files
|
|
22
|
-
UnlinkedIO = begin
|
|
23
|
-
tmp = Unicorn::Util.tmpio
|
|
24
|
-
tmp.chmod(0)
|
|
25
|
-
tmp.close
|
|
26
|
-
true
|
|
27
|
-
rescue
|
|
28
|
-
false
|
|
29
|
-
end
|
|
30
|
-
|
|
31
21
|
# we don't actually fork workers, but allow using the
|
|
32
22
|
# {before,after}_fork hooks found in Unicorn/Rainbows!
|
|
33
23
|
# config files...
|
|
34
24
|
FORK_HOOK = lambda { |_,_| }
|
|
35
|
-
|
|
36
25
|
end
|
|
37
26
|
|
|
38
27
|
# :stopdoc:
|
|
@@ -47,12 +36,7 @@ module Rainbows
|
|
|
47
36
|
build_app! unless preload_app
|
|
48
37
|
Rainbows::Response.setup(self.class)
|
|
49
38
|
Rainbows::MaxBody.setup
|
|
50
|
-
|
|
51
|
-
# avoid spurious wakeups and blocking-accept() with 1.8 green threads
|
|
52
|
-
if RUBY_VERSION.to_f < 1.9
|
|
53
|
-
require "io/nonblock"
|
|
54
|
-
HttpServer::LISTENERS.each { |l| l.nonblock = true }
|
|
55
|
-
end
|
|
39
|
+
Rainbows::ProcessClient.const_set(:APP, @app)
|
|
56
40
|
|
|
57
41
|
logger.info "Zbatery #@use worker_connections=#@worker_connections"
|
|
58
42
|
end
|
|
@@ -68,6 +52,7 @@ module Rainbows
|
|
|
68
52
|
# this class is only used to avoid breaking Unicorn user switching
|
|
69
53
|
class DeadIO
|
|
70
54
|
def chown(*args); end
|
|
55
|
+
alias fcntl chown
|
|
71
56
|
end
|
|
72
57
|
|
|
73
58
|
# only used if no concurrency model is specified
|
|
@@ -75,11 +60,8 @@ module Rainbows
|
|
|
75
60
|
init_worker_process(worker)
|
|
76
61
|
begin
|
|
77
62
|
ret = IO.select(LISTENERS, nil, nil, nil) and
|
|
78
|
-
ret.
|
|
79
|
-
|
|
80
|
-
process_client(sock.accept_nonblock)
|
|
81
|
-
rescue Errno::EAGAIN, Errno::ECONNABORTED
|
|
82
|
-
end
|
|
63
|
+
ret[0].each do |sock|
|
|
64
|
+
io = sock.kgio_tryaccept and process_client(io)
|
|
83
65
|
end
|
|
84
66
|
rescue Errno::EINTR
|
|
85
67
|
rescue Errno::EBADF, TypeError
|
|
@@ -108,32 +90,24 @@ module Rainbows
|
|
|
108
90
|
end
|
|
109
91
|
|
|
110
92
|
def join
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
trap(:HUP) { reexec; stop }
|
|
122
|
-
|
|
123
|
-
# technically feasible in some cases, just not sanely supportable:
|
|
124
|
-
%w(TTIN TTOU WINCH).each do |sig|
|
|
125
|
-
trap(sig) { logger.info "SIG#{sig} is not handled by Zbatery" }
|
|
126
|
-
end
|
|
127
|
-
rescue => e # hopefully ignores errors on Win32...
|
|
128
|
-
logger.error "failed to setup signal handler: #{e.message}"
|
|
93
|
+
trap(:INT) { stop(false) }
|
|
94
|
+
trap(:TERM) { stop(false) }
|
|
95
|
+
trap(:QUIT) { stop }
|
|
96
|
+
trap(:USR1) { reopen_logs }
|
|
97
|
+
trap(:USR2) { reexec }
|
|
98
|
+
trap(:HUP) { reexec; stop }
|
|
99
|
+
|
|
100
|
+
# technically feasible in some cases, just not sanely supportable:
|
|
101
|
+
%w(TTIN TTOU WINCH).each do |sig|
|
|
102
|
+
trap(sig) { logger.info "SIG#{sig} is not handled by Zbatery" }
|
|
129
103
|
end
|
|
130
104
|
|
|
131
105
|
if ready_pipe
|
|
132
106
|
ready_pipe.syswrite($$.to_s)
|
|
133
|
-
ready_pipe.close
|
|
107
|
+
ready_pipe.close
|
|
134
108
|
self.ready_pipe = nil
|
|
135
109
|
end
|
|
136
|
-
|
|
110
|
+
extend(Rainbows.const_get(@use))
|
|
137
111
|
worker = Worker.new(0, DeadIO.new)
|
|
138
112
|
before_fork.call(self, worker)
|
|
139
113
|
worker_loop(worker) # runs forever
|
|
@@ -160,24 +134,5 @@ module Rainbows
|
|
|
160
134
|
end
|
|
161
135
|
end
|
|
162
136
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
class Configurator
|
|
166
|
-
DEFAULTS[:before_fork] = DEFAULTS[:after_fork] = Zbatery::FORK_HOOK
|
|
167
|
-
end
|
|
168
|
-
|
|
169
|
-
unless Zbatery::UnlinkedIO
|
|
170
|
-
require 'tempfile'
|
|
171
|
-
class Util
|
|
172
|
-
|
|
173
|
-
# Tempfiles should get automatically unlinked by GC
|
|
174
|
-
def self.tmpio
|
|
175
|
-
fp = Tempfile.new("zbatery")
|
|
176
|
-
fp.binmode
|
|
177
|
-
fp.sync = true
|
|
178
|
-
fp
|
|
179
|
-
end
|
|
180
|
-
end
|
|
181
|
-
end
|
|
182
|
-
|
|
183
|
-
end
|
|
137
|
+
Unicorn::Configurator::DEFAULTS[:before_fork] =
|
|
138
|
+
Unicorn::Configurator::DEFAULTS[:after_fork] = Zbatery::FORK_HOOK
|
data/t/test_isolate.rb
CHANGED
|
@@ -14,9 +14,9 @@ old_out = $stdout.dup
|
|
|
14
14
|
$stdout.reopen($stderr)
|
|
15
15
|
|
|
16
16
|
Isolate.now!(opts) do
|
|
17
|
-
gem 'rack', '1.1
|
|
18
|
-
gem 'unicorn', '
|
|
19
|
-
gem 'rainbows', '0.
|
|
17
|
+
gem 'rack', '1.2.1'
|
|
18
|
+
gem 'unicorn', '2.0.0'
|
|
19
|
+
gem 'rainbows', '1.0.0'
|
|
20
20
|
|
|
21
21
|
if engine == "ruby"
|
|
22
22
|
gem 'sendfile', '1.0.0' # next Rubinius should support this
|
|
@@ -29,7 +29,6 @@ Isolate.now!(opts) do
|
|
|
29
29
|
gem 'async_sinatra', '0.2.1'
|
|
30
30
|
|
|
31
31
|
gem 'neverblock', '0.1.6.2'
|
|
32
|
-
gem 'cramp', '0.11'
|
|
33
32
|
end
|
|
34
33
|
|
|
35
34
|
if defined?(::Fiber) && engine == "ruby"
|
data/zbatery.gemspec
CHANGED
|
@@ -50,12 +50,8 @@ Gem::Specification.new do |s|
|
|
|
50
50
|
# espace-neverblock + eventmachine
|
|
51
51
|
# async_sinatra + sinatra + eventmachine
|
|
52
52
|
#
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
# untrusted clients (a configuration only supported by Zbatery and Rainbows!,
|
|
56
|
-
# Unicorn has never and will never be supported without trusted LAN clients.
|
|
57
|
-
s.add_dependency(%q<rainbows>, [">= 0.95.1", "<= 1.0.0"])
|
|
58
|
-
s.add_development_dependency(%q<isolate>, "~> 2.1.0")
|
|
53
|
+
s.add_dependency(%q<rainbows>, ["~> 1.0.0"])
|
|
54
|
+
s.add_development_dependency(%q<isolate>, "~> 3.0.0")
|
|
59
55
|
|
|
60
56
|
# s.licenses = %w(GPLv2 Ruby) # accessor not compatible with older RubyGems
|
|
61
57
|
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: zbatery
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 15
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
version: 0.
|
|
8
|
+
- 4
|
|
9
|
+
- 0
|
|
10
|
+
version: 0.4.0
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Zbatery hackers
|
|
@@ -15,7 +15,7 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date: 2010-
|
|
18
|
+
date: 2010-10-28 00:00:00 +00:00
|
|
19
19
|
default_executable:
|
|
20
20
|
dependencies:
|
|
21
21
|
- !ruby/object:Gem::Dependency
|
|
@@ -24,15 +24,7 @@ dependencies:
|
|
|
24
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
|
25
25
|
none: false
|
|
26
26
|
requirements:
|
|
27
|
-
- -
|
|
28
|
-
- !ruby/object:Gem::Version
|
|
29
|
-
hash: 353
|
|
30
|
-
segments:
|
|
31
|
-
- 0
|
|
32
|
-
- 95
|
|
33
|
-
- 1
|
|
34
|
-
version: 0.95.1
|
|
35
|
-
- - <=
|
|
27
|
+
- - ~>
|
|
36
28
|
- !ruby/object:Gem::Version
|
|
37
29
|
hash: 23
|
|
38
30
|
segments:
|
|
@@ -50,12 +42,12 @@ dependencies:
|
|
|
50
42
|
requirements:
|
|
51
43
|
- - ~>
|
|
52
44
|
- !ruby/object:Gem::Version
|
|
53
|
-
hash:
|
|
45
|
+
hash: 7
|
|
54
46
|
segments:
|
|
55
|
-
-
|
|
56
|
-
-
|
|
47
|
+
- 3
|
|
48
|
+
- 0
|
|
57
49
|
- 0
|
|
58
|
-
version:
|
|
50
|
+
version: 3.0.0
|
|
59
51
|
type: :development
|
|
60
52
|
version_requirements: *id002
|
|
61
53
|
description: |-
|