thin 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of thin might be problematic. Click here for more details.
- data/CHANGELOG +6 -0
- data/lib/thin/controllers/cluster.rb +2 -2
- data/lib/thin/daemonizing.rb +17 -6
- data/lib/thin/runner.rb +1 -0
- data/lib/thin/server.rb +8 -2
- data/lib/thin/version.rb +2 -2
- data/lib/thin_parser.bundle +0 -0
- data/spec/controllers/cluster_spec.rb +23 -0
- metadata +2 -4
data/CHANGELOG
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
== 1.2.2 I Find Your Lack of Sauce Disturbing release
|
2
|
+
* Fix force kill under 1.9 [Alexey Chebotar]
|
3
|
+
* Fix regression when --only option is used w/ --socket.
|
4
|
+
* Add process name 'tag' functionality. Easier to distinguish thin daemons
|
5
|
+
from eachother in process listing [ctcherry]
|
6
|
+
|
1
7
|
== 1.2.1 Asynctilicious Ultra Supreme release
|
2
8
|
* Require Rack 1.0.0
|
3
9
|
* Require EventMachine 0.12.6
|
@@ -102,9 +102,9 @@ module Thin
|
|
102
102
|
|
103
103
|
def with_each_server
|
104
104
|
if only
|
105
|
-
if only < 80
|
105
|
+
if first_port && only < 80
|
106
106
|
# interpret +only+ as a sequence number
|
107
|
-
yield
|
107
|
+
yield first_port + only
|
108
108
|
else
|
109
109
|
# interpret +only+ as an absolute port number
|
110
110
|
yield only
|
data/lib/thin/daemonizing.rb
CHANGED
@@ -108,16 +108,14 @@ module Thin
|
|
108
108
|
|
109
109
|
# Send a +signal+ to the process which PID is stored in +pid_file+.
|
110
110
|
def send_signal(signal, pid_file, timeout=60)
|
111
|
-
if
|
112
|
-
pid = pid.to_i
|
111
|
+
if pid = read_pid_file(pid_file)
|
113
112
|
Logging.log "Sending #{signal} signal to process #{pid} ... "
|
114
113
|
Process.kill(signal, pid)
|
115
114
|
Timeout.timeout(timeout) do
|
116
115
|
sleep 0.1 while Process.running?(pid)
|
117
116
|
end
|
118
|
-
Logging.log ""
|
119
117
|
else
|
120
|
-
|
118
|
+
Logging.log "Can't stop process, no PID found in #{pid_file}"
|
121
119
|
end
|
122
120
|
rescue Timeout::Error
|
123
121
|
Logging.log "Timeout!"
|
@@ -130,8 +128,21 @@ module Thin
|
|
130
128
|
end
|
131
129
|
|
132
130
|
def force_kill(pid_file)
|
133
|
-
|
134
|
-
|
131
|
+
if pid = read_pid_file(pid_file)
|
132
|
+
Logging.log "Sending KILL signal to process #{pid} ... "
|
133
|
+
Process.kill("KILL", pid)
|
134
|
+
File.delete(pid_file) if File.exist?(pid_file)
|
135
|
+
else
|
136
|
+
Logging.log "Can't stop process, no PID found in #{pid_file}"
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
def read_pid_file(file)
|
141
|
+
if File.file?(file) && pid = File.read(file)
|
142
|
+
pid.to_i
|
143
|
+
else
|
144
|
+
nil
|
145
|
+
end
|
135
146
|
end
|
136
147
|
end
|
137
148
|
|
data/lib/thin/runner.rb
CHANGED
@@ -87,6 +87,7 @@ module Thin
|
|
87
87
|
"(default: #{@options[:pid]})") { |file| @options[:pid] = file }
|
88
88
|
opts.on("-u", "--user NAME", "User to run daemon as (use with -g)") { |user| @options[:user] = user }
|
89
89
|
opts.on("-g", "--group NAME", "Group to run daemon as (use with -u)") { |group| @options[:group] = group }
|
90
|
+
opts.on( "--tag NAME", "Additional text to display in process listing") { |tag| @options[:tag] = tag }
|
90
91
|
|
91
92
|
opts.separator ""
|
92
93
|
opts.separator "Cluster options:"
|
data/lib/thin/server.rb
CHANGED
@@ -59,7 +59,10 @@ module Thin
|
|
59
59
|
|
60
60
|
# Application (Rack adapter) called with the request that produces the response.
|
61
61
|
attr_accessor :app
|
62
|
-
|
62
|
+
|
63
|
+
# A tag that will show in the process listing
|
64
|
+
attr_accessor :tag
|
65
|
+
|
63
66
|
# Backend handling the connections to the clients.
|
64
67
|
attr_accessor :backend
|
65
68
|
|
@@ -103,6 +106,9 @@ module Thin
|
|
103
106
|
end
|
104
107
|
end
|
105
108
|
|
109
|
+
# Set tag if needed
|
110
|
+
self.tag = options[:tag]
|
111
|
+
|
106
112
|
# Try to intelligently select which backend to use.
|
107
113
|
@backend = select_backend(host, port, options)
|
108
114
|
|
@@ -188,7 +194,7 @@ module Thin
|
|
188
194
|
# Name of the server and type of backend used.
|
189
195
|
# This is also the name of the process in which Thin is running as a daemon.
|
190
196
|
def name
|
191
|
-
"thin server (#{@backend})"
|
197
|
+
"thin server (#{@backend})" + (tag ? " [#{tag}]" : "")
|
192
198
|
end
|
193
199
|
alias :to_s :name
|
194
200
|
|
data/lib/thin/version.rb
CHANGED
@@ -6,11 +6,11 @@ module Thin
|
|
6
6
|
module VERSION #:nodoc:
|
7
7
|
MAJOR = 1
|
8
8
|
MINOR = 2
|
9
|
-
TINY =
|
9
|
+
TINY = 2
|
10
10
|
|
11
11
|
STRING = [MAJOR, MINOR, TINY].join('.')
|
12
12
|
|
13
|
-
CODENAME = "
|
13
|
+
CODENAME = "I Find Your Lack of Sauce Disturbing".freeze
|
14
14
|
|
15
15
|
RACK = [1, 0].freeze # Rack protocol version
|
16
16
|
end
|
data/lib/thin_parser.bundle
CHANGED
Binary file
|
@@ -135,6 +135,29 @@ describe Cluster, "controlling only one server" do
|
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
138
|
+
describe Cluster, "controlling only one server with UNIX socket" do
|
139
|
+
before do
|
140
|
+
@cluster = Cluster.new(:chdir => '/rails_app',
|
141
|
+
:socket => '/tmp/thin.sock',
|
142
|
+
:address => '0.0.0.0',
|
143
|
+
:port => 3000,
|
144
|
+
:servers => 3,
|
145
|
+
:timeout => 10,
|
146
|
+
:log => 'thin.log',
|
147
|
+
:pid => 'thin.pid',
|
148
|
+
:only => 1
|
149
|
+
)
|
150
|
+
end
|
151
|
+
|
152
|
+
it 'should call only specified server' do
|
153
|
+
calls = []
|
154
|
+
@cluster.send(:with_each_server) do |n|
|
155
|
+
calls << n
|
156
|
+
end
|
157
|
+
calls.should == [1]
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
138
161
|
describe Cluster, "controlling only one server, by sequence number" do
|
139
162
|
before do
|
140
163
|
@cluster = Cluster.new(:chdir => '/rails_app',
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marc-Andre Cournoyer
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-05-
|
12
|
+
date: 2009-05-21 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -182,8 +182,6 @@ files:
|
|
182
182
|
- spec/rails_app/script/process/spawner
|
183
183
|
- spec/rails_app/script/runner
|
184
184
|
- spec/rails_app/script/server
|
185
|
-
- spec/rails_app/tmp
|
186
|
-
- spec/rails_app/tmp/pids
|
187
185
|
- spec/request
|
188
186
|
- spec/request/mongrel_spec.rb
|
189
187
|
- spec/request/parser_spec.rb
|