codeclimate 0.35.1 → 0.35.2

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cc/analyzer/container.rb +14 -5
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6a645991c744635df303a345f6a2e82d0fdbe355
4
- data.tar.gz: f9ee567049514596fb20c7e28c2cc7a9e24ff7c1
3
+ metadata.gz: d89520fad83fbb50d3b157b90ab06e0570e33efe
4
+ data.tar.gz: c940f78b63be95cb4b83809324c5598673fe4359
5
5
  SHA512:
6
- metadata.gz: 43ded224e244ecac15204adbb16adfe4811c8601c99e336f52dd0d3c84a3196cf76c03e5384521cb959757206f9f28f0d6c8f6e5401bae117e9b93aef8ff9bac
7
- data.tar.gz: 5d7a6c904e5b7e44ccb9b6f24ee0bac6b0b841f10995490aa79cc1b4a2df54b5a9f6a0f03eded487f13421e90b734577188966a71c8023cf5f957b939523de6e
6
+ metadata.gz: b8b0eab306b1f7a8cbc8070a59347b8275973a4fd9ab21352dd6e9cad99489f87503d4e6d1310a11f92c81bfd824ad16de4b2b4dd18728de4b66850a09be1319
7
+ data.tar.gz: d706dc63889d0c8538f9efeb453cca2bba267b3542e8ff61f0aa60902c9377caf7b408c95159d4574a0d838ffc531db94585e12ca9b5e29949a3d5afe6de6acc
@@ -56,9 +56,13 @@ module CC
56
56
  @t_err = read_stderr(err)
57
57
  t_timeout = timeout_thread
58
58
 
59
- # blocks until the engine stops. there may still be stdout in flight if
60
- # it was being produced more quickly than consumed.
61
- _, status = Process.waitpid2(pid)
59
+ # blocks until the engine stops. this is put in a thread so that we can
60
+ # explicitly abort it as part of #stop. otherwise a run-away container
61
+ # could still block here forever if the docker-kill/wait is not
62
+ # successful. there may still be stdout in flight if it was being
63
+ # produced more quickly than consumed.
64
+ @t_wait = Thread.new { _, @status = Process.waitpid2(pid) }
65
+ @t_wait.join
62
66
 
63
67
  # blocks until all readers are done. they're still governed by the
64
68
  # timeout thread at this point. if we hit the timeout while processing
@@ -71,11 +75,11 @@ module CC
71
75
  @listener.timed_out(container_data(duration: duration))
72
76
  else
73
77
  duration = ((Time.now - started) * 1000).round
74
- @listener.finished(container_data(duration: duration, status: status))
78
+ @listener.finished(container_data(duration: duration, status: @status))
75
79
  end
76
80
 
77
81
  Result.new(
78
- status.exitstatus,
82
+ @status && @status.exitstatus,
79
83
  @timed_out,
80
84
  duration,
81
85
  @maximum_output_exceeded,
@@ -90,6 +94,7 @@ module CC
90
94
  def stop(message = nil)
91
95
  reap_running_container(message)
92
96
  kill_reader_threads
97
+ kill_wait_thread
93
98
  end
94
99
 
95
100
  private
@@ -170,6 +175,10 @@ module CC
170
175
  @t_err.kill if @t_err
171
176
  end
172
177
 
178
+ def kill_wait_thread
179
+ @t_wait.kill if @t_wait
180
+ end
181
+
173
182
  def reap_running_container(message)
174
183
  Analyzer.logger.warn("killing container name=#{@name} message=#{message.inspect}")
175
184
  POSIX::Spawn::Child.new("docker", "kill", @name, timeout: 2.minutes)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codeclimate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.35.1
4
+ version: 0.35.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code Climate
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-20 00:00:00.000000000 Z
11
+ date: 2016-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport