ohai 6.18.0.rc.0 → 6.18.0.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ohai/mixin/command.rb +4 -0
- data/lib/ohai/version.rb +1 -1
- data/spec/unit/mixin/command_spec.rb +22 -0
- metadata +2 -2
data/lib/ohai/mixin/command.rb
CHANGED
@@ -224,6 +224,10 @@ module Ohai
|
|
224
224
|
|
225
225
|
begin
|
226
226
|
e = Marshal.load ps.first
|
227
|
+
pw.last.close
|
228
|
+
pr.first.close
|
229
|
+
pe.first.close
|
230
|
+
Process.wait(cid)
|
227
231
|
raise(Exception === e ? e : "unknown failure!")
|
228
232
|
rescue EOFError # If we get an EOF error, then the exec was successful
|
229
233
|
42
|
data/lib/ohai/version.rb
CHANGED
@@ -44,4 +44,26 @@ describe Ohai::Mixin::Command, "popen4" do
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
+
it "reaps zombie processes after exec fails [OHAI-455]" do
|
48
|
+
# NOTE: depending on ulimit settings, GC, etc., before the OHAI-455 patch,
|
49
|
+
# ohai could also exhaust the available file descriptors when creating this
|
50
|
+
# many zombie processes. A regression _could_ cause Errno::EMFILE but this
|
51
|
+
# probably won't be consistent on different environments.
|
52
|
+
created_procs = 0
|
53
|
+
100.times do
|
54
|
+
begin
|
55
|
+
Ohai::Mixin::Command.popen4("/bin/this-is-not-a-real-command") {|p,i,o,e| nil }
|
56
|
+
rescue Ohai::Exceptions::Exec
|
57
|
+
created_procs += 1
|
58
|
+
end
|
59
|
+
end
|
60
|
+
created_procs.should == 100
|
61
|
+
reaped_procs = 0
|
62
|
+
begin
|
63
|
+
loop { Process.wait(-1); reaped_procs += 1 }
|
64
|
+
rescue Errno::ECHILD
|
65
|
+
end
|
66
|
+
reaped_procs.should == 0
|
67
|
+
end
|
68
|
+
|
47
69
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ohai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.18.0.rc.
|
4
|
+
version: 6.18.0.rc.1
|
5
5
|
prerelease: 7
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: systemu
|