preplay_unicorn 4.3.1.2.gc450 → 4.3.1.5.ga7df
Sign up to get free protection for your applications and to get access to all the features.
- data/Documentation/unicorn.1.txt +3 -3
- data/Documentation/unicorn_rails.1.txt +3 -3
- data/README +8 -0
- data/SIGNALS +8 -8
- data/Sandbox +1 -1
- data/examples/init.sh +3 -3
- data/examples/unicorn.conf.rb +2 -2
- data/lib/unicorn.rb +1 -1
- data/lib/unicorn/http_server.rb +21 -10
- data/t/listener_names.ru +4 -0
- data/t/t0004-heartbeat-timeout.sh +1 -1
- data/t/t0008-back_out_of_upgrade.sh +1 -1
- data/t/t0010-reap-logging.sh +1 -1
- data/t/t0020-at_exit-handler.sh +2 -2
- data/t/t0022-listener_names-preload_app.sh +32 -0
- data/t/t9000-preread-input.sh +1 -1
- data/t/t9001-oob_gc.sh +1 -1
- data/t/t9002-oob_gc-path.sh +1 -1
- data/test/exec/test_exec.rb +21 -21
- data/test/rails/test_rails.rb +3 -3
- data/test/test_helper.rb +4 -4
- data/test/unit/test_signals.rb +2 -2
- metadata +48 -13
data/Documentation/unicorn.1.txt
CHANGED
@@ -109,12 +109,12 @@ with rackup(1) but strongly discouraged.
|
|
109
109
|
The following UNIX signals may be sent to the master process:
|
110
110
|
|
111
111
|
* HUP - reload config file, app, and gracefully restart all workers
|
112
|
-
*
|
113
|
-
*
|
112
|
+
* QUIT - quick shutdown, kills all workers immediately
|
113
|
+
* INT/TERM - graceful shutdown, waits for workers to finish their
|
114
114
|
current request before finishing.
|
115
115
|
* USR1 - reopen all logs owned by the master and all workers
|
116
116
|
See Unicorn::Util.reopen_logs for what is considered a log.
|
117
|
-
* USR2 - reexecute the running binary. A separate
|
117
|
+
* USR2 - reexecute the running binary. A separate TERM
|
118
118
|
should be sent to the original process once the child is verified to
|
119
119
|
be up and running.
|
120
120
|
* WINCH - gracefully stops workers but keep the master running.
|
@@ -144,12 +144,12 @@ doing transparent upgrades.
|
|
144
144
|
The following UNIX signals may be sent to the master process:
|
145
145
|
|
146
146
|
* HUP - reload config file, app, and gracefully restart all workers
|
147
|
-
*
|
148
|
-
*
|
147
|
+
* QUIT - quick shutdown, kills all workers immediately
|
148
|
+
* INT/TERM - graceful shutdown, waits for workers to finish their
|
149
149
|
current request before finishing.
|
150
150
|
* USR1 - reopen all logs owned by the master and all workers
|
151
151
|
See Unicorn::Util.reopen_logs for what is considered a log.
|
152
|
-
* USR2 - reexecute the running binary. A separate
|
152
|
+
* USR2 - reexecute the running binary. A separate TERM
|
153
153
|
should be sent to the original process once the child is verified to
|
154
154
|
be up and running.
|
155
155
|
* WINCH - gracefully stops workers but keep the master running.
|
data/README
CHANGED
@@ -6,6 +6,14 @@ advantage of features in Unix/Unix-like kernels. Slow clients should
|
|
6
6
|
only be served by placing a reverse proxy capable of fully buffering
|
7
7
|
both the the request and response in between \Unicorn and slow clients.
|
8
8
|
|
9
|
+
== Signal handling patch
|
10
|
+
|
11
|
+
This fork of Unicorn is designed to run on Heroku. Heroku and Unicorn
|
12
|
+
disagree on signal handling, so I've swapped Unicorn's handling of
|
13
|
+
SIGINT/SIGTERM and SIGQUIT. Now, Unicorn can shut down gracefully on
|
14
|
+
Heroku.
|
15
|
+
|
16
|
+
|
9
17
|
== Features
|
10
18
|
|
11
19
|
* Designed for Rack, Unix, fast clients, and ease-of-debugging. We
|
data/SIGNALS
CHANGED
@@ -13,7 +13,7 @@ Unicorn and nginx.
|
|
13
13
|
If the "preload_app" directive is false (the default), then workers
|
14
14
|
will also pick up any application code changes when restarted. If
|
15
15
|
"preload_app" is true, then application code changes will have no
|
16
|
-
effect; USR2 +
|
16
|
+
effect; USR2 + TERM (see below) must be used to load newer code in
|
17
17
|
this case. When reloading the application, +Gem.refresh+ will
|
18
18
|
be called so updated code for your application can pick up newly
|
19
19
|
installed RubyGems. It is not recommended that you uninstall
|
@@ -21,15 +21,15 @@ Unicorn and nginx.
|
|
21
21
|
as respawned workers may enter a spawn loop when they fail to
|
22
22
|
load an uninstalled dependency.
|
23
23
|
|
24
|
-
*
|
24
|
+
* QUIT - quick shutdown, kills all workers immediately
|
25
25
|
|
26
|
-
*
|
26
|
+
* INT/TERM - graceful shutdown, waits for workers to finish their
|
27
27
|
current request before finishing.
|
28
28
|
|
29
29
|
* USR1 - reopen all logs owned by the master and all workers
|
30
30
|
See Unicorn::Util.reopen_logs for what is considered a log.
|
31
31
|
|
32
|
-
* USR2 - reexecute the running binary. A separate
|
32
|
+
* USR2 - reexecute the running binary. A separate TERM
|
33
33
|
should be sent to the original process once the child is verified to
|
34
34
|
be up and running.
|
35
35
|
|
@@ -46,11 +46,11 @@ Sending signals directly to the worker processes should not normally be
|
|
46
46
|
needed. If the master process is running, any exited worker will be
|
47
47
|
automatically respawned.
|
48
48
|
|
49
|
-
*
|
49
|
+
* QUIT - Quick shutdown, immediately exit.
|
50
50
|
Unless WINCH has been sent to the master (or the master is killed),
|
51
51
|
the master process will respawn a worker to replace this one.
|
52
52
|
|
53
|
-
*
|
53
|
+
* INT/TERM - Gracefully exit after finishing the current request.
|
54
54
|
Unless WINCH has been sent to the master (or the master is killed),
|
55
55
|
the master process will respawn a worker to replace this one.
|
56
56
|
|
@@ -107,8 +107,8 @@ The procedure is exactly like that of nginx:
|
|
107
107
|
4. You should now ensure that everything is running correctly with the
|
108
108
|
new workers as the old workers die off.
|
109
109
|
|
110
|
-
5. If everything seems ok, then send
|
110
|
+
5. If everything seems ok, then send TERM to the old master. You're done!
|
111
111
|
|
112
112
|
If something is broken, then send HUP to the old master to reload
|
113
|
-
the config and restart its workers. Then send
|
113
|
+
the config and restart its workers. Then send TERM to the new master
|
114
114
|
process.
|
data/Sandbox
CHANGED
@@ -21,7 +21,7 @@ this:
|
|
21
21
|
|
22
22
|
Unicorn::HttpServer::START_CTX[0] = "/some/path/to/bin/unicorn"
|
23
23
|
|
24
|
-
Then use HUP to reload, and then continue with the USR2+
|
24
|
+
Then use HUP to reload, and then continue with the USR2+TERM upgrade
|
25
25
|
sequence.
|
26
26
|
|
27
27
|
Environment variable pollution when exec-ing a new process (with USR2)
|
data/examples/init.sh
CHANGED
@@ -32,11 +32,11 @@ start)
|
|
32
32
|
$CMD
|
33
33
|
;;
|
34
34
|
stop)
|
35
|
-
sig
|
35
|
+
sig TERM && exit 0
|
36
36
|
echo >&2 "Not running"
|
37
37
|
;;
|
38
38
|
force-stop)
|
39
|
-
sig
|
39
|
+
sig QUIT && exit 0
|
40
40
|
echo >&2 "Not running"
|
41
41
|
;;
|
42
42
|
restart|reload)
|
@@ -45,7 +45,7 @@ restart|reload)
|
|
45
45
|
$CMD
|
46
46
|
;;
|
47
47
|
upgrade)
|
48
|
-
if sig USR2 && sleep 2 && sig 0 && oldsig
|
48
|
+
if sig USR2 && sleep 2 && sig 0 && oldsig TERM
|
49
49
|
then
|
50
50
|
n=$TIMEOUT
|
51
51
|
while test -s $old_pid && test $n -ge 0
|
data/examples/unicorn.conf.rb
CHANGED
@@ -60,11 +60,11 @@ before_fork do |server, worker|
|
|
60
60
|
# # phase out the old master process with SIGTTOU to avoid a
|
61
61
|
# # thundering herd (especially in the "preload_app false" case)
|
62
62
|
# # when doing a transparent upgrade. The last worker spawned
|
63
|
-
# # will then kill off the old master process with a
|
63
|
+
# # will then kill off the old master process with a SIGTERM.
|
64
64
|
# old_pid = "#{server.config[:pid]}.oldbin"
|
65
65
|
# if old_pid != server.pid
|
66
66
|
# begin
|
67
|
-
# sig = (worker.nr + 1) >= server.worker_processes ? :
|
67
|
+
# sig = (worker.nr + 1) >= server.worker_processes ? :TERM : :TTOU
|
68
68
|
# Process.kill(sig, File.read(old_pid).to_i)
|
69
69
|
# rescue Errno::ENOENT, Errno::ESRCH
|
70
70
|
# end
|
data/lib/unicorn.rb
CHANGED
data/lib/unicorn/http_server.rb
CHANGED
@@ -28,6 +28,9 @@ class Unicorn::HttpServer
|
|
28
28
|
# all bound listener sockets
|
29
29
|
LISTENERS = []
|
30
30
|
|
31
|
+
# listeners we have yet to bind
|
32
|
+
NEW_LISTENERS = []
|
33
|
+
|
31
34
|
# This hash maps PIDs to Workers
|
32
35
|
WORKERS = {}
|
33
36
|
|
@@ -71,7 +74,7 @@ class Unicorn::HttpServer
|
|
71
74
|
#
|
72
75
|
# To change your unicorn executable to a different path without downtime,
|
73
76
|
# you can set the following in your Unicorn config file, HUP and then
|
74
|
-
# continue with the traditional USR2 +
|
77
|
+
# continue with the traditional USR2 + TERM upgrade steps:
|
75
78
|
#
|
76
79
|
# Unicorn::HttpServer::START_CTX[0] = "/home/bofh/1.9.2/bin/unicorn"
|
77
80
|
START_CTX = {
|
@@ -134,6 +137,7 @@ class Unicorn::HttpServer
|
|
134
137
|
|
135
138
|
self.master_pid = $$
|
136
139
|
build_app! if preload_app
|
140
|
+
bind_new_listeners!
|
137
141
|
spawn_missing_workers
|
138
142
|
self
|
139
143
|
end
|
@@ -271,9 +275,9 @@ class Unicorn::HttpServer
|
|
271
275
|
end
|
272
276
|
maintain_worker_count if respawn
|
273
277
|
master_sleep(sleep_time)
|
274
|
-
when :
|
278
|
+
when :TERM, :INT # graceful shutdown
|
275
279
|
break
|
276
|
-
when :
|
280
|
+
when :QUIT # immediate shutdown
|
277
281
|
stop(false)
|
278
282
|
break
|
279
283
|
when :USR1 # rotate logs
|
@@ -287,7 +291,7 @@ class Unicorn::HttpServer
|
|
287
291
|
if Unicorn::Configurator::RACKUP[:daemonized]
|
288
292
|
respawn = false
|
289
293
|
logger.info "gracefully stopping all workers"
|
290
|
-
kill_each_worker(:
|
294
|
+
kill_each_worker(:TERM)
|
291
295
|
self.worker_processes = 0
|
292
296
|
else
|
293
297
|
logger.info "SIGWINCH ignored because we're not daemonized"
|
@@ -322,7 +326,7 @@ class Unicorn::HttpServer
|
|
322
326
|
self.listeners = []
|
323
327
|
limit = Time.now + timeout
|
324
328
|
until WORKERS.empty? || Time.now > limit
|
325
|
-
kill_each_worker(graceful ? :
|
329
|
+
kill_each_worker(graceful ? :TERM : :QUIT)
|
326
330
|
sleep(0.1)
|
327
331
|
reap_all_workers
|
328
332
|
end
|
@@ -500,7 +504,7 @@ class Unicorn::HttpServer
|
|
500
504
|
(off = WORKERS.size - worker_processes) == 0 and return
|
501
505
|
off < 0 and return spawn_missing_workers
|
502
506
|
WORKERS.dup.each_pair { |wpid,w|
|
503
|
-
w.nr >= worker_processes and kill_worker(:
|
507
|
+
w.nr >= worker_processes and kill_worker(:TERM, wpid) rescue nil
|
504
508
|
}
|
505
509
|
end
|
506
510
|
|
@@ -554,7 +558,7 @@ class Unicorn::HttpServer
|
|
554
558
|
# traps for USR1, USR2, and HUP may be set in the after_fork Proc
|
555
559
|
# by the user.
|
556
560
|
def init_worker_process(worker)
|
557
|
-
# we'll re-trap :
|
561
|
+
# we'll re-trap :TERM later for graceful shutdown iff we accept clients
|
558
562
|
EXIT_SIGS.each { |sig| trap(sig) { exit!(0) } }
|
559
563
|
exit!(0) if (SIG_QUEUE & EXIT_SIGS)[0]
|
560
564
|
WORKER_QUEUE_SIGS.each { |sig| trap(sig, nil) }
|
@@ -596,7 +600,7 @@ class Unicorn::HttpServer
|
|
596
600
|
|
597
601
|
# closing anything we IO.select on will raise EBADF
|
598
602
|
trap(:USR1) { nr = -65536; SELF_PIPE[0].close rescue nil }
|
599
|
-
trap(:
|
603
|
+
trap(:TERM) { worker = nil; LISTENERS.each { |s| s.close rescue nil }.clear }
|
600
604
|
logger.info "worker=#{worker.nr} ready"
|
601
605
|
Process.kill(:URG, ppid)
|
602
606
|
|
@@ -675,7 +679,7 @@ class Unicorn::HttpServer
|
|
675
679
|
config[:listeners].replace(@init_listeners)
|
676
680
|
config.reload
|
677
681
|
config.commit!(self)
|
678
|
-
kill_each_worker(:
|
682
|
+
kill_each_worker(:TERM)
|
679
683
|
Unicorn::Util.reopen_logs
|
680
684
|
self.app = orig_app
|
681
685
|
build_app! if preload_app
|
@@ -742,7 +746,14 @@ class Unicorn::HttpServer
|
|
742
746
|
@init_listeners << Unicorn::Const::DEFAULT_LISTEN
|
743
747
|
START_CTX[:argv] << "-l#{Unicorn::Const::DEFAULT_LISTEN}"
|
744
748
|
end
|
745
|
-
|
749
|
+
NEW_LISTENERS.replace(config_listeners)
|
750
|
+
end
|
751
|
+
|
752
|
+
# call only after calling inherit_listeners!
|
753
|
+
# This binds any listeners we did NOT inherit from the parent
|
754
|
+
def bind_new_listeners!
|
755
|
+
NEW_LISTENERS.each { |addr| listen(addr) }
|
746
756
|
raise ArgumentError, "no listeners" if LISTENERS.empty?
|
757
|
+
NEW_LISTENERS.clear
|
747
758
|
end
|
748
759
|
end
|
data/t/listener_names.ru
ADDED
data/t/t0010-reap-logging.sh
CHANGED
data/t/t0020-at_exit-handler.sh
CHANGED
@@ -23,8 +23,8 @@ t_begin "read worker PID" && {
|
|
23
23
|
t_info "worker_pid=$worker_pid"
|
24
24
|
}
|
25
25
|
|
26
|
-
t_begin "issue graceful shutdown (
|
27
|
-
kill -
|
26
|
+
t_begin "issue graceful shutdown (SIGTERM) and wait for termination" && {
|
27
|
+
kill -TERM $unicorn_pid
|
28
28
|
|
29
29
|
while kill -0 $unicorn_pid >/dev/null 2>&1
|
30
30
|
do
|
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
. ./test-lib.sh
|
3
|
+
|
4
|
+
# Raindrops::Middleware depends on Unicorn.listener_names,
|
5
|
+
# ensure we don't break Raindrops::Middleware when preload_app is true
|
6
|
+
|
7
|
+
t_plan 4 "Unicorn.listener_names available with preload_app=true"
|
8
|
+
|
9
|
+
t_begin "setup and startup" && {
|
10
|
+
unicorn_setup
|
11
|
+
echo preload_app true >> $unicorn_config
|
12
|
+
unicorn -E none -D listener_names.ru -c $unicorn_config
|
13
|
+
unicorn_wait_start
|
14
|
+
}
|
15
|
+
|
16
|
+
t_begin "read listener names includes listener" && {
|
17
|
+
resp=$(curl -sSf http://$listen/)
|
18
|
+
ok=false
|
19
|
+
t_info "resp=$resp"
|
20
|
+
case $resp in
|
21
|
+
*\"$listen\"*) ok=true ;;
|
22
|
+
esac
|
23
|
+
$ok
|
24
|
+
}
|
25
|
+
|
26
|
+
t_begin "killing succeeds" && {
|
27
|
+
kill $unicorn_pid
|
28
|
+
}
|
29
|
+
|
30
|
+
t_begin "check stderr" && check_stderr
|
31
|
+
|
32
|
+
t_done
|
data/t/t9000-preread-input.sh
CHANGED
data/t/t9001-oob_gc.sh
CHANGED
data/t/t9002-oob_gc-path.sh
CHANGED
data/test/exec/test_exec.rb
CHANGED
@@ -21,7 +21,7 @@ unless try_require('rack')
|
|
21
21
|
end
|
22
22
|
|
23
23
|
class ExecTest < Test::Unit::TestCase
|
24
|
-
trap(:
|
24
|
+
trap(:TERM, 'IGNORE')
|
25
25
|
|
26
26
|
HI = <<-EOS
|
27
27
|
use Rack::ContentLength
|
@@ -87,7 +87,7 @@ run lambda { |env|
|
|
87
87
|
FileUtils.rmtree(@tmpdir)
|
88
88
|
@sockets.each { |path| File.unlink(path) rescue nil }
|
89
89
|
loop do
|
90
|
-
Process.kill('-
|
90
|
+
Process.kill('-TERM', 0)
|
91
91
|
begin
|
92
92
|
Process.waitpid(-1, Process::WNOHANG) or break
|
93
93
|
rescue Errno::ECHILD
|
@@ -139,7 +139,7 @@ EOF
|
|
139
139
|
results = hit(["http://#@addr:#@port/"])
|
140
140
|
assert_equal other.path, results.first
|
141
141
|
|
142
|
-
Process.kill(:
|
142
|
+
Process.kill(:TERM, pid)
|
143
143
|
ensure
|
144
144
|
FileUtils.rmtree(other.path)
|
145
145
|
end
|
@@ -175,7 +175,7 @@ EOF
|
|
175
175
|
results = hit(["http://#@addr:#@port/"])
|
176
176
|
assert_equal other.path, results.first
|
177
177
|
|
178
|
-
Process.kill(:
|
178
|
+
Process.kill(:TERM, pid)
|
179
179
|
ensure
|
180
180
|
FileUtils.rmtree(other.path)
|
181
181
|
end
|
@@ -217,7 +217,7 @@ EOF
|
|
217
217
|
assert File.exist?("#{other.path}/stdout_log_here")
|
218
218
|
wait_master_ready("#{other.path}/stderr_log_here")
|
219
219
|
|
220
|
-
Process.kill(:
|
220
|
+
Process.kill(:TERM, pid)
|
221
221
|
ensure
|
222
222
|
FileUtils.rmtree(other.path)
|
223
223
|
end
|
@@ -350,7 +350,7 @@ EOF
|
|
350
350
|
wait_for_file(old_file)
|
351
351
|
wait_for_file(pid_file)
|
352
352
|
old_pid = File.read(old_file).to_i
|
353
|
-
Process.kill(:
|
353
|
+
Process.kill(:TERM, old_pid)
|
354
354
|
wait_for_death(old_pid)
|
355
355
|
|
356
356
|
ucfg.syswrite("timeout %(#{pid_file})\n") # introduce a bug
|
@@ -394,8 +394,8 @@ EOF
|
|
394
394
|
assert_equal String, results[1].class
|
395
395
|
|
396
396
|
assert_nothing_raised do
|
397
|
-
Process.kill(:
|
398
|
-
Process.kill(:
|
397
|
+
Process.kill(:TERM, current_pid)
|
398
|
+
Process.kill(:TERM, new_pid)
|
399
399
|
end
|
400
400
|
end
|
401
401
|
|
@@ -420,7 +420,7 @@ EOF
|
|
420
420
|
wait_for_file(old_file)
|
421
421
|
wait_for_file(pid_file)
|
422
422
|
old_pid = File.read(old_file).to_i
|
423
|
-
Process.kill(:
|
423
|
+
Process.kill(:TERM, old_pid)
|
424
424
|
wait_for_death(old_pid)
|
425
425
|
|
426
426
|
File.unlink("config.ru") # break reloading
|
@@ -456,8 +456,8 @@ EOF
|
|
456
456
|
assert_equal String, results[0].class
|
457
457
|
|
458
458
|
assert_nothing_raised do
|
459
|
-
Process.kill(:
|
460
|
-
Process.kill(:
|
459
|
+
Process.kill(:TERM, current_pid)
|
460
|
+
Process.kill(:TERM, new_pid)
|
461
461
|
end
|
462
462
|
end
|
463
463
|
|
@@ -599,7 +599,7 @@ EOF
|
|
599
599
|
end
|
600
600
|
assert_equal 5, log.grep(/done reopening logs/).size
|
601
601
|
assert_equal 0, log.grep(/reopening logs\.\.\./).size
|
602
|
-
assert_nothing_raised { Process.kill(:
|
602
|
+
assert_nothing_raised { Process.kill(:TERM, pid) }
|
603
603
|
status = nil
|
604
604
|
assert_nothing_raised { pid, status = Process.waitpid2(pid) }
|
605
605
|
assert status.success?, "exited successfully"
|
@@ -848,7 +848,7 @@ EOF
|
|
848
848
|
assert_nothing_raised do
|
849
849
|
Process.kill(:USR2, pid)
|
850
850
|
wait_for_file("#{pid_file}.oldbin")
|
851
|
-
Process.kill(:
|
851
|
+
Process.kill(:TERM, pid)
|
852
852
|
end
|
853
853
|
wait_for_death(pid)
|
854
854
|
|
@@ -868,7 +868,7 @@ EOF
|
|
868
868
|
assert_nothing_raised do
|
869
869
|
Process.kill(:USR2, pid)
|
870
870
|
wait_for_file("#{pid_file}.oldbin")
|
871
|
-
Process.kill(:
|
871
|
+
Process.kill(:TERM, pid)
|
872
872
|
end
|
873
873
|
wait_for_death(pid)
|
874
874
|
|
@@ -881,7 +881,7 @@ EOF
|
|
881
881
|
assert $?.success?
|
882
882
|
assert_equal expect_size, curr_fds.size, curr_fds.inspect
|
883
883
|
|
884
|
-
Process.kill(:
|
884
|
+
Process.kill(:TERM, pid)
|
885
885
|
wait_for_death(pid)
|
886
886
|
end
|
887
887
|
|
@@ -908,7 +908,7 @@ EOF
|
|
908
908
|
r.close
|
909
909
|
bodies = Hash.new(0)
|
910
910
|
at_exit { pids.syswrite(bodies.inspect) }
|
911
|
-
trap(:
|
911
|
+
trap(:QUIT) { exit(0) }
|
912
912
|
nr = 0
|
913
913
|
loop {
|
914
914
|
rv = Net::HTTP.get(uri)
|
@@ -930,7 +930,7 @@ EOF
|
|
930
930
|
assert daemon_pid > 0
|
931
931
|
Process.kill(:HUP, daemon_pid)
|
932
932
|
assert_equal '2', r.read(1)
|
933
|
-
assert_nothing_raised { Process.kill(:
|
933
|
+
assert_nothing_raised { Process.kill(:QUIT, hitter) }
|
934
934
|
_, hitter_status = Process.waitpid2(hitter)
|
935
935
|
assert(hitter_status.success?,
|
936
936
|
"invalid: #{hitter_status.inspect} #{File.read(pids.path)}" \
|
@@ -944,7 +944,7 @@ EOF
|
|
944
944
|
assert x > 0
|
945
945
|
assert pids[x] > 0
|
946
946
|
}
|
947
|
-
assert_nothing_raised { Process.kill(:
|
947
|
+
assert_nothing_raised { Process.kill(:TERM, daemon_pid) }
|
948
948
|
wait_for_death(daemon_pid)
|
949
949
|
end
|
950
950
|
|
@@ -965,7 +965,7 @@ EOF
|
|
965
965
|
res2 = hit(["http://#{Unicorn::Const::DEFAULT_LISTEN}/"])
|
966
966
|
assert_match %r{\d+}, res2.first
|
967
967
|
assert res2.first != res.first
|
968
|
-
assert_nothing_raised { Process.kill(:
|
968
|
+
assert_nothing_raised { Process.kill(:TERM, daemon_pid) }
|
969
969
|
wait_for_death(daemon_pid)
|
970
970
|
end
|
971
971
|
end
|
@@ -978,7 +978,7 @@ EOF
|
|
978
978
|
Process.kill(:USR2, daemon_pid)
|
979
979
|
wait_for_file("#{pid_path}.oldbin")
|
980
980
|
wait_for_file(pid_path)
|
981
|
-
Process.kill(:
|
981
|
+
Process.kill(:TERM, daemon_pid)
|
982
982
|
wait_for_death(daemon_pid)
|
983
983
|
}
|
984
984
|
daemon_pid = File.read(pid_path).to_i
|
@@ -995,7 +995,7 @@ EOF
|
|
995
995
|
res3 = hit(["http://#{Unicorn::Const::DEFAULT_LISTEN}/"])
|
996
996
|
assert res2.first != res3.first
|
997
997
|
|
998
|
-
assert_nothing_raised { Process.kill(:
|
998
|
+
assert_nothing_raised { Process.kill(:TERM, daemon_pid) }
|
999
999
|
wait_for_death(daemon_pid)
|
1000
1000
|
end
|
1001
1001
|
end
|
data/test/rails/test_rails.rb
CHANGED
@@ -60,7 +60,7 @@ elsif RB_V[0] >= 1 && RB_V[1] >= 9
|
|
60
60
|
end
|
61
61
|
|
62
62
|
class RailsTest < Test::Unit::TestCase
|
63
|
-
trap(:
|
63
|
+
trap(:TERM, 'IGNORE')
|
64
64
|
|
65
65
|
COMMON_TMP = Tempfile.new('unicorn_tmp') unless defined?(COMMON_TMP)
|
66
66
|
|
@@ -267,7 +267,7 @@ logger Logger.new('#{COMMON_TMP.path}')
|
|
267
267
|
return if @start_pid != $$
|
268
268
|
|
269
269
|
if @pid
|
270
|
-
Process.kill(:
|
270
|
+
Process.kill(:TERM, @pid)
|
271
271
|
_, status = Process.waitpid2(@pid)
|
272
272
|
assert status.success?
|
273
273
|
end
|
@@ -275,7 +275,7 @@ logger Logger.new('#{COMMON_TMP.path}')
|
|
275
275
|
Dir.chdir(@pwd)
|
276
276
|
FileUtils.rmtree(@tmpdir)
|
277
277
|
loop do
|
278
|
-
Process.kill('-
|
278
|
+
Process.kill('-TERM', 0)
|
279
279
|
begin
|
280
280
|
Process.waitpid(-1, Process::WNOHANG) or break
|
281
281
|
rescue Errno::ECHILD
|
data/test/test_helper.rb
CHANGED
@@ -155,7 +155,7 @@ end
|
|
155
155
|
|
156
156
|
def assert_shutdown(pid)
|
157
157
|
wait_master_ready("test_stderr.#{pid}.log")
|
158
|
-
assert_nothing_raised { Process.kill(:
|
158
|
+
assert_nothing_raised { Process.kill(:TERM, pid) }
|
159
159
|
status = nil
|
160
160
|
assert_nothing_raised { pid, status = Process.waitpid2(pid) }
|
161
161
|
assert status.success?, "exited successfully"
|
@@ -202,12 +202,12 @@ def reexec_usr2_quit_test(pid, pid_file)
|
|
202
202
|
# kill old master process
|
203
203
|
assert_not_equal pid, new_pid
|
204
204
|
assert_equal pid, old_pid
|
205
|
-
assert_nothing_raised { Process.kill(:
|
205
|
+
assert_nothing_raised { Process.kill(:TERM, old_pid) }
|
206
206
|
assert_nothing_raised { retry_hit(["http://#{@addr}:#{@port}/"]) }
|
207
207
|
wait_for_death(old_pid)
|
208
208
|
assert_equal new_pid, File.read(pid_file).to_i
|
209
209
|
assert_nothing_raised { retry_hit(["http://#{@addr}:#{@port}/"]) }
|
210
|
-
assert_nothing_raised { Process.kill(:
|
210
|
+
assert_nothing_raised { Process.kill(:TERM, new_pid) }
|
211
211
|
end
|
212
212
|
|
213
213
|
def reexec_basic_test(pid, pid_file)
|
@@ -230,7 +230,7 @@ def reexec_basic_test(pid, pid_file)
|
|
230
230
|
new_pid = File.read(pid_file).to_i
|
231
231
|
assert_not_equal pid, new_pid
|
232
232
|
assert_nothing_raised { Process.kill(0, new_pid) }
|
233
|
-
assert_nothing_raised { Process.kill(:
|
233
|
+
assert_nothing_raised { Process.kill(:TERM, new_pid) }
|
234
234
|
end
|
235
235
|
|
236
236
|
def wait_for_file(path)
|
data/test/unit/test_signals.rb
CHANGED
@@ -88,7 +88,7 @@ class SignalsTest < Test::Unit::TestCase
|
|
88
88
|
sock.syswrite("GET / HTTP/1.0\r\n\r\n")
|
89
89
|
buf = rd.readpartial(1)
|
90
90
|
wait_master_ready("test_stderr.#{pid}.log")
|
91
|
-
Process.kill(:
|
91
|
+
Process.kill(:QUIT, pid)
|
92
92
|
Process.waitpid(pid)
|
93
93
|
end
|
94
94
|
assert_equal '.', buf
|
@@ -125,7 +125,7 @@ class SignalsTest < Test::Unit::TestCase
|
|
125
125
|
assert diff > 1.0, "diff was #{diff.inspect}"
|
126
126
|
assert diff < 60.0
|
127
127
|
ensure
|
128
|
-
Process.kill(:
|
128
|
+
Process.kill(:QUIT, pid) rescue nil
|
129
129
|
end
|
130
130
|
|
131
131
|
def test_response_write
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: !binary |-
|
3
3
|
cHJlcGxheV91bmljb3Ju
|
4
4
|
version: !ruby/object:Gem::Version
|
5
|
-
version: 4.3.1.
|
5
|
+
version: 4.3.1.5.ga7df
|
6
6
|
prerelease: 8
|
7
7
|
platform: ruby
|
8
8
|
authors:
|
@@ -10,12 +10,12 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-10-17 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: !binary |-
|
17
17
|
cmFjaw==
|
18
|
-
requirement:
|
18
|
+
requirement: !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ! '>='
|
@@ -23,11 +23,16 @@ dependencies:
|
|
23
23
|
version: '0'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
|
-
version_requirements:
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
28
|
+
requirements:
|
29
|
+
- - ! '>='
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: '0'
|
27
32
|
- !ruby/object:Gem::Dependency
|
28
33
|
name: !binary |-
|
29
34
|
a2dpbw==
|
30
|
-
requirement:
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
31
36
|
none: false
|
32
37
|
requirements:
|
33
38
|
- - !binary |-
|
@@ -37,11 +42,18 @@ dependencies:
|
|
37
42
|
Mi42
|
38
43
|
type: :runtime
|
39
44
|
prerelease: false
|
40
|
-
version_requirements:
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
none: false
|
47
|
+
requirements:
|
48
|
+
- - !binary |-
|
49
|
+
fj4=
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: !binary |-
|
52
|
+
Mi42
|
41
53
|
- !ruby/object:Gem::Dependency
|
42
54
|
name: !binary |-
|
43
55
|
cmFpbmRyb3Bz
|
44
|
-
requirement:
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
45
57
|
none: false
|
46
58
|
requirements:
|
47
59
|
- - !binary |-
|
@@ -51,11 +63,18 @@ dependencies:
|
|
51
63
|
MC43
|
52
64
|
type: :runtime
|
53
65
|
prerelease: false
|
54
|
-
version_requirements:
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - !binary |-
|
70
|
+
fj4=
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: !binary |-
|
73
|
+
MC43
|
55
74
|
- !ruby/object:Gem::Dependency
|
56
75
|
name: !binary |-
|
57
76
|
aXNvbGF0ZQ==
|
58
|
-
requirement:
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
59
78
|
none: false
|
60
79
|
requirements:
|
61
80
|
- - !binary |-
|
@@ -65,11 +84,18 @@ dependencies:
|
|
65
84
|
My4y
|
66
85
|
type: :development
|
67
86
|
prerelease: false
|
68
|
-
version_requirements:
|
87
|
+
version_requirements: !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
89
|
+
requirements:
|
90
|
+
- - !binary |-
|
91
|
+
fj4=
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: !binary |-
|
94
|
+
My4y
|
69
95
|
- !ruby/object:Gem::Dependency
|
70
96
|
name: !binary |-
|
71
97
|
d3Jvbmdkb2M=
|
72
|
-
requirement:
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
73
99
|
none: false
|
74
100
|
requirements:
|
75
101
|
- - !binary |-
|
@@ -79,7 +105,14 @@ dependencies:
|
|
79
105
|
MS42LjE=
|
80
106
|
type: :development
|
81
107
|
prerelease: false
|
82
|
-
version_requirements:
|
108
|
+
version_requirements: !ruby/object:Gem::Requirement
|
109
|
+
none: false
|
110
|
+
requirements:
|
111
|
+
- - !binary |-
|
112
|
+
fj4=
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: !binary |-
|
115
|
+
MS42LjE=
|
83
116
|
description: ! '\Unicorn is an HTTP server for Rack applications designed to only
|
84
117
|
serve
|
85
118
|
|
@@ -223,6 +256,7 @@ files:
|
|
223
256
|
- t/detach.ru
|
224
257
|
- t/env.ru
|
225
258
|
- t/heartbeat-timeout.ru
|
259
|
+
- t/listener_names.ru
|
226
260
|
- t/my-tap-lib.sh
|
227
261
|
- t/oob_gc.ru
|
228
262
|
- t/oob_gc_path.ru
|
@@ -289,6 +323,7 @@ files:
|
|
289
323
|
- t/t0019-max_header_len.sh
|
290
324
|
- t/t0020-at_exit-handler.sh
|
291
325
|
- t/t0021-process_detach.sh
|
326
|
+
- t/t0022-listener_names-preload_app.sh
|
292
327
|
- t/t0100-rack-input-tests.sh
|
293
328
|
- t/t0116-client_body_buffer_size.sh
|
294
329
|
- t/t0116.ru
|
@@ -412,7 +447,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
412
447
|
requirements: []
|
413
448
|
rubyforge_project: !binary |-
|
414
449
|
bW9uZ3JlbA==
|
415
|
-
rubygems_version: 1.8.
|
450
|
+
rubygems_version: 1.8.24
|
416
451
|
signing_key:
|
417
452
|
specification_version: 3
|
418
453
|
summary: Rack HTTP server for fast clients and Unix
|