einhorn 0.7.2 → 0.7.3
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/README.md +2 -3
- data/einhorn.gemspec +1 -0
- data/lib/einhorn/command.rb +17 -8
- data/lib/einhorn/command/interface.rb +6 -6
- data/lib/einhorn/event/connection.rb +2 -2
- data/lib/einhorn/version.rb +1 -1
- metadata +58 -23
- checksums.yaml +0 -7
data/README.md
CHANGED
@@ -249,10 +249,9 @@ EventMachine-LE to support file-descriptor passing. Check out
|
|
249
249
|
|
250
250
|
## Compatibility
|
251
251
|
|
252
|
-
Einhorn
|
252
|
+
Einhorn runs in Ruby 2.0, 2.1, and 2.2
|
253
253
|
|
254
254
|
## About
|
255
255
|
|
256
|
-
Einhorn is a project of [Stripe](https://stripe.com), led by [
|
257
|
-
Brockman](https://twitter.com/thegdb). Feel free to get in touch at
|
256
|
+
Einhorn is a project of [Stripe](https://stripe.com), led by [Carl Jackson](https://github.com/zenazn). Feel free to get in touch at
|
258
257
|
info@stripe.com.
|
data/einhorn.gemspec
CHANGED
@@ -15,6 +15,7 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.name = 'einhorn'
|
16
16
|
gem.require_paths = ['lib']
|
17
17
|
|
18
|
+
gem.add_development_dependency 'rack', '~> 1.6'
|
18
19
|
gem.add_development_dependency 'rake'
|
19
20
|
gem.add_development_dependency 'pry'
|
20
21
|
gem.add_development_dependency 'minitest', '< 5.0'
|
data/lib/einhorn/command.rb
CHANGED
@@ -99,7 +99,7 @@ module Einhorn
|
|
99
99
|
def self.signal_all(signal, children=nil, record=true)
|
100
100
|
children ||= Einhorn::WorkerPool.workers
|
101
101
|
|
102
|
-
signaled =
|
102
|
+
signaled = {}
|
103
103
|
Einhorn.log_info("Sending #{signal} to #{children.inspect}", :upgrade)
|
104
104
|
|
105
105
|
children.each do |child|
|
@@ -119,16 +119,23 @@ module Einhorn
|
|
119
119
|
Process.kill(signal, child)
|
120
120
|
rescue Errno::ESRCH
|
121
121
|
else
|
122
|
-
signaled
|
122
|
+
signaled[child] = spec
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
126
|
-
if Einhorn::State.signal_timeout
|
126
|
+
if Einhorn::State.signal_timeout && record
|
127
127
|
Einhorn::Event::Timer.open(Einhorn::State.signal_timeout) do
|
128
128
|
children.each do |child|
|
129
|
-
|
129
|
+
spec = Einhorn::State.children[child]
|
130
|
+
next unless spec # Process is already dead and removed by mourn
|
131
|
+
signaled_spec = signaled[child]
|
132
|
+
next unless signaled_spec # We got ESRCH when trying to signal
|
133
|
+
if spec[:spinup_time] != signaled_spec[:spinup_time]
|
134
|
+
Einhorn.log_info("Different spinup time recorded for #{child} after #{Einhorn::State.signal_timeout}s. This probably indicates a PID rollover.", :upgrade)
|
135
|
+
next
|
136
|
+
end
|
130
137
|
|
131
|
-
Einhorn.log_info("Child #{child.inspect} is still active after #{Einhorn::State.signal_timeout}. Sending SIGKILL.")
|
138
|
+
Einhorn.log_info("Child #{child.inspect} is still active after #{Einhorn::State.signal_timeout}s. Sending SIGKILL.")
|
132
139
|
begin
|
133
140
|
Process.kill('KILL', child)
|
134
141
|
rescue Errno::ESRCH
|
@@ -138,7 +145,7 @@ module Einhorn
|
|
138
145
|
end
|
139
146
|
end
|
140
147
|
|
141
|
-
"Successfully sent #{signal}s to #{signaled.length} processes: #{signaled.
|
148
|
+
"Successfully sent #{signal}s to #{signaled.length} processes: #{signaled.keys}"
|
142
149
|
end
|
143
150
|
|
144
151
|
def self.increment
|
@@ -291,14 +298,15 @@ module Einhorn
|
|
291
298
|
end
|
292
299
|
|
293
300
|
Einhorn.log_info("===> Launched #{pid} (index: #{index})", :upgrade)
|
301
|
+
Einhorn::State.last_spinup = Time.now
|
294
302
|
Einhorn::State.children[pid] = {
|
295
303
|
:type => :worker,
|
296
304
|
:version => Einhorn::State.version,
|
297
305
|
:acked => false,
|
298
306
|
:signaled => Set.new,
|
299
|
-
:index => index
|
307
|
+
:index => index,
|
308
|
+
:spinup_time => Einhorn::State.last_spinup,
|
300
309
|
}
|
301
|
-
Einhorn::State.last_spinup = Time.now
|
302
310
|
|
303
311
|
# Set up whatever's needed for ACKing
|
304
312
|
ack_mode = Einhorn::State.ack_mode
|
@@ -364,6 +372,7 @@ module Einhorn
|
|
364
372
|
end
|
365
373
|
|
366
374
|
def self.prepare_child_process
|
375
|
+
Process.setpgrp
|
367
376
|
Einhorn.renice_self
|
368
377
|
end
|
369
378
|
|
@@ -148,17 +148,17 @@ module Einhorn::Command
|
|
148
148
|
## Signals
|
149
149
|
def self.install_handlers
|
150
150
|
trap_async("INT") do
|
151
|
-
Einhorn::Command.signal_all("USR2"
|
151
|
+
Einhorn::Command.signal_all("USR2")
|
152
152
|
Einhorn::Command.stop_respawning
|
153
153
|
end
|
154
154
|
trap_async("TERM") do
|
155
|
-
Einhorn::Command.signal_all("TERM"
|
155
|
+
Einhorn::Command.signal_all("TERM")
|
156
156
|
Einhorn::Command.stop_respawning
|
157
157
|
end
|
158
158
|
# Note that quit is a bit different, in that it will actually
|
159
159
|
# make Einhorn quit without waiting for children to exit.
|
160
160
|
trap_async("QUIT") do
|
161
|
-
Einhorn::Command.signal_all("QUIT"
|
161
|
+
Einhorn::Command.signal_all("QUIT")
|
162
162
|
Einhorn::Command.stop_respawning
|
163
163
|
exit(1)
|
164
164
|
end
|
@@ -169,12 +169,12 @@ module Einhorn::Command
|
|
169
169
|
end
|
170
170
|
trap_async("CHLD") {}
|
171
171
|
trap_async("USR2") do
|
172
|
-
Einhorn::Command.signal_all("USR2"
|
172
|
+
Einhorn::Command.signal_all("USR2")
|
173
173
|
Einhorn::Command.stop_respawning
|
174
174
|
end
|
175
175
|
at_exit do
|
176
176
|
if Einhorn::State.kill_children_on_exit && Einhorn::TransientState.whatami == :master
|
177
|
-
Einhorn::Command.signal_all("USR2"
|
177
|
+
Einhorn::Command.signal_all("USR2")
|
178
178
|
Einhorn::Command.stop_respawning
|
179
179
|
end
|
180
180
|
end
|
@@ -407,7 +407,7 @@ EOF
|
|
407
407
|
|
408
408
|
signal = args[0] || "USR2"
|
409
409
|
|
410
|
-
response = Einhorn::Command.signal_all(signal
|
410
|
+
response = Einhorn::Command.signal_all(signal)
|
411
411
|
Einhorn::Command.stop_respawning
|
412
412
|
|
413
413
|
"Einhorn is going down! #{response}"
|
@@ -57,13 +57,13 @@ module Einhorn::Event
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def register!
|
60
|
-
|
60
|
+
log_debug("client connected")
|
61
61
|
Einhorn::Event.register_connection(self, @socket.fileno)
|
62
62
|
super
|
63
63
|
end
|
64
64
|
|
65
65
|
def deregister!
|
66
|
-
|
66
|
+
log_debug("client disconnected") if Einhorn::TransientState.whatami == :master
|
67
67
|
Einhorn::Event.deregister_connection(@socket.fileno)
|
68
68
|
super
|
69
69
|
end
|
data/lib/einhorn/version.rb
CHANGED
metadata
CHANGED
@@ -1,97 +1,126 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: einhorn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.3
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Greg Brockman
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2016-
|
12
|
+
date: 2016-07-11 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rack
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.6'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.6'
|
13
30
|
- !ruby/object:Gem::Dependency
|
14
31
|
name: rake
|
15
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
16
34
|
requirements:
|
17
|
-
- -
|
35
|
+
- - ! '>='
|
18
36
|
- !ruby/object:Gem::Version
|
19
37
|
version: '0'
|
20
38
|
type: :development
|
21
39
|
prerelease: false
|
22
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
23
42
|
requirements:
|
24
|
-
- -
|
43
|
+
- - ! '>='
|
25
44
|
- !ruby/object:Gem::Version
|
26
45
|
version: '0'
|
27
46
|
- !ruby/object:Gem::Dependency
|
28
47
|
name: pry
|
29
48
|
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
30
50
|
requirements:
|
31
|
-
- -
|
51
|
+
- - ! '>='
|
32
52
|
- !ruby/object:Gem::Version
|
33
53
|
version: '0'
|
34
54
|
type: :development
|
35
55
|
prerelease: false
|
36
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
37
58
|
requirements:
|
38
|
-
- -
|
59
|
+
- - ! '>='
|
39
60
|
- !ruby/object:Gem::Version
|
40
61
|
version: '0'
|
41
62
|
- !ruby/object:Gem::Dependency
|
42
63
|
name: minitest
|
43
64
|
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
44
66
|
requirements:
|
45
|
-
- -
|
67
|
+
- - <
|
46
68
|
- !ruby/object:Gem::Version
|
47
69
|
version: '5.0'
|
48
70
|
type: :development
|
49
71
|
prerelease: false
|
50
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
51
74
|
requirements:
|
52
|
-
- -
|
75
|
+
- - <
|
53
76
|
- !ruby/object:Gem::Version
|
54
77
|
version: '5.0'
|
55
78
|
- !ruby/object:Gem::Dependency
|
56
79
|
name: mocha
|
57
80
|
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
58
82
|
requirements:
|
59
|
-
- -
|
83
|
+
- - ~>
|
60
84
|
- !ruby/object:Gem::Version
|
61
85
|
version: '0.13'
|
62
86
|
type: :development
|
63
87
|
prerelease: false
|
64
88
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
65
90
|
requirements:
|
66
|
-
- -
|
91
|
+
- - ~>
|
67
92
|
- !ruby/object:Gem::Version
|
68
93
|
version: '0.13'
|
69
94
|
- !ruby/object:Gem::Dependency
|
70
95
|
name: chalk-rake
|
71
96
|
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
72
98
|
requirements:
|
73
|
-
- -
|
99
|
+
- - ! '>='
|
74
100
|
- !ruby/object:Gem::Version
|
75
101
|
version: '0'
|
76
102
|
type: :development
|
77
103
|
prerelease: false
|
78
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
79
106
|
requirements:
|
80
|
-
- -
|
107
|
+
- - ! '>='
|
81
108
|
- !ruby/object:Gem::Version
|
82
109
|
version: '0'
|
83
110
|
- !ruby/object:Gem::Dependency
|
84
111
|
name: subprocess
|
85
112
|
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
86
114
|
requirements:
|
87
|
-
- -
|
115
|
+
- - ! '>='
|
88
116
|
- !ruby/object:Gem::Version
|
89
117
|
version: '0'
|
90
118
|
type: :development
|
91
119
|
prerelease: false
|
92
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
93
122
|
requirements:
|
94
|
-
- -
|
123
|
+
- - ! '>='
|
95
124
|
- !ruby/object:Gem::Version
|
96
125
|
version: '0'
|
97
126
|
description: Einhorn makes it easy to run multiple instances of an application server,
|
@@ -106,8 +135,8 @@ executables:
|
|
106
135
|
extensions: []
|
107
136
|
extra_rdoc_files: []
|
108
137
|
files:
|
109
|
-
-
|
110
|
-
-
|
138
|
+
- .gitignore
|
139
|
+
- .travis.yml
|
111
140
|
- CONTRIBUTORS
|
112
141
|
- Gemfile
|
113
142
|
- History.txt
|
@@ -157,27 +186,34 @@ files:
|
|
157
186
|
homepage: https://github.com/stripe/einhorn
|
158
187
|
licenses:
|
159
188
|
- MIT
|
160
|
-
metadata: {}
|
161
189
|
post_install_message:
|
162
190
|
rdoc_options: []
|
163
191
|
require_paths:
|
164
192
|
- lib
|
165
193
|
required_ruby_version: !ruby/object:Gem::Requirement
|
194
|
+
none: false
|
166
195
|
requirements:
|
167
|
-
- -
|
196
|
+
- - ! '>='
|
168
197
|
- !ruby/object:Gem::Version
|
169
198
|
version: '0'
|
199
|
+
segments:
|
200
|
+
- 0
|
201
|
+
hash: -3456360524100968279
|
170
202
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
203
|
+
none: false
|
171
204
|
requirements:
|
172
|
-
- -
|
205
|
+
- - ! '>='
|
173
206
|
- !ruby/object:Gem::Version
|
174
207
|
version: '0'
|
208
|
+
segments:
|
209
|
+
- 0
|
210
|
+
hash: -3456360524100968279
|
175
211
|
requirements: []
|
176
212
|
rubyforge_project:
|
177
|
-
rubygems_version:
|
213
|
+
rubygems_version: 1.8.23
|
178
214
|
signing_key:
|
179
|
-
specification_version:
|
180
|
-
summary: 'Einhorn: the language-independent shared socket manager'
|
215
|
+
specification_version: 3
|
216
|
+
summary: ! 'Einhorn: the language-independent shared socket manager'
|
181
217
|
test_files:
|
182
218
|
- test/_lib.rb
|
183
219
|
- test/integration/_lib.rb
|
@@ -195,4 +231,3 @@ test_files:
|
|
195
231
|
- test/unit/einhorn/command/interface.rb
|
196
232
|
- test/unit/einhorn/event.rb
|
197
233
|
- test/unit/einhorn/worker_pool.rb
|
198
|
-
has_rdoc:
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 9ad5953d5d76feb2ece4284c0c69db2ab3aa42d6
|
4
|
-
data.tar.gz: a9e7290ffcf43ba56b5987bb51a3a45a94e18d84
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 9170d915de608cc8b467c474cbafaafbf4d0dbcac6103d446a67f3897a0c119247a213f84858b344a7c8ce2fa251be8e4370880bf35fbe92808831192c6191e1
|
7
|
-
data.tar.gz: 92d76cdf34932a638be91c330219658570113b07bfeb76fe24291d74d6c374ee6b19939a9c120138ccc958f0af921ac6f99fa833211e7614dfd1df71c164f890
|