async-container 0.27.3 → 0.27.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a8429de04372759748416b6b4e52a99ea6f7e89702f46d988d25301f958ca877
4
- data.tar.gz: c24245f1fe1228f61418717be4f3096503682bfe4e3b12b2bfb1272a89e0f16e
3
+ metadata.gz: b33373c25e8c39d091f9f9013eb12579d08f01c03ec14612767b607041d59688
4
+ data.tar.gz: 2990fa6ab90beb2a67b9bf4ef47c8b8c58590426df73652642d771544c9d15dd
5
5
  SHA512:
6
- metadata.gz: df4d5a6c2a9c24fa7a054deda82445653690b7e51bb6828921b703ae77debb20eec636d2db962990501263a33482695e9d05eeb9170c1d72243bfd5f60d5d2a1
7
- data.tar.gz: 972c007d20d6f023c8fea9f162009a37af2449947ff502e2e9af7041c025991726aafc0f2a19bef10be02d1c9612a99e1bf04d9612752cdfbf8d839de3ca9d37
6
+ metadata.gz: 30a81d6c5eede1bf527b9f4493efcd41f2080db091eacb96cfa841cda6c044d52d45bb714dda55009c26bfc1834b18219ff1552116852dc0a7daa7c5a8d34d87
7
+ data.tar.gz: be8f6b931ed89cbef3ae8cf04c73519b3184d47ead5a0d3cbe84fb8b99fb178eb031c482b25b2380936450ae97134b0e2c8362d10b6c293e979b8c356cf32b20
checksums.yaml.gz.sig CHANGED
Binary file
@@ -191,6 +191,8 @@ module Async
191
191
  age_clock = state[:age] = Clock.start
192
192
  end
193
193
 
194
+ status = nil
195
+
194
196
  begin
195
197
  status = @group.wait_for(child) do |message|
196
198
  case message
@@ -203,11 +205,13 @@ module Async
203
205
  age_clock&.reset!
204
206
  end
205
207
  end
208
+ rescue => error
209
+ Console.error(self, "Error during child process management!", exception: error, running: @running)
206
210
  ensure
207
211
  delete(key, child)
208
212
  end
209
213
 
210
- if status.success?
214
+ if status&.success?
211
215
  Console.info(self, "Child exited successfully.", status: status, running: @running)
212
216
  else
213
217
  @statistics.failure!
@@ -220,9 +224,6 @@ module Async
220
224
  break
221
225
  end
222
226
  end
223
- rescue => error
224
- Console.error(self, "Failure during child process management!", exception: error, running: @running)
225
- raise
226
227
  ensure
227
228
  Console.info(self, "Child process management loop exited.", running: @running)
228
229
  end.resume
@@ -100,9 +100,14 @@ module Async
100
100
  end
101
101
  end
102
102
 
103
+ private def each_running(&block)
104
+ # We create a copy of the values here, in case the block modifies the running set:
105
+ @running.values.each(&block)
106
+ end
107
+
103
108
  # Perform a health check on all running processes.
104
109
  def health_check!
105
- @running.each_value do |fiber|
110
+ each_running do |fiber|
106
111
  fiber.resume(:health_check!)
107
112
  end
108
113
  end
@@ -111,7 +116,7 @@ module Async
111
116
  # This resumes the controlling fiber with an instance of {Interrupt}.
112
117
  def interrupt
113
118
  Console.info(self, "Sending interrupt to #{@running.size} running processes...")
114
- @running.each_value do |fiber|
119
+ each_running do |fiber|
115
120
  fiber.resume(Interrupt)
116
121
  end
117
122
  end
@@ -120,7 +125,7 @@ module Async
120
125
  # This resumes the controlling fiber with an instance of {Terminate}.
121
126
  def terminate
122
127
  Console.info(self, "Sending terminate to #{@running.size} running processes...")
123
- @running.each_value do |fiber|
128
+ each_running do |fiber|
124
129
  fiber.resume(Terminate)
125
130
  end
126
131
  end
@@ -129,7 +134,7 @@ module Async
129
134
  # This resumes the controlling fiber with an instance of {Kill}.
130
135
  def kill
131
136
  Console.info(self, "Sending kill to #{@running.size} running processes...")
132
- @running.each_value do |fiber|
137
+ each_running do |fiber|
133
138
  fiber.resume(Kill)
134
139
  end
135
140
  end
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Async
7
7
  module Container
8
- VERSION = "0.27.3"
8
+ VERSION = "0.27.5"
9
9
  end
10
10
  end
data/readme.md CHANGED
@@ -26,6 +26,14 @@ Please see the [project documentation](https://socketry.github.io/async-containe
26
26
 
27
27
  Please see the [project releases](https://socketry.github.io/async-container/releases/index) for all releases.
28
28
 
29
+ ### v0.27.5
30
+
31
+ - Make the child handling more robust in the face of exceptions.
32
+
33
+ ### v0.27.4
34
+
35
+ - Fix race condition where `wait_for` could modify `@running` while it was being iterated over (`each_value`) during health checks.
36
+
29
37
  ### v0.27.3
30
38
 
31
39
  - Add log for starting child, including container statistics.
@@ -60,15 +68,6 @@ Please see the [project releases](https://socketry.github.io/async-container/rel
60
68
 
61
69
  - [Add support for `NOTIFY_LOG` for Kubernetes readiness probes.](https://socketry.github.io/async-container/releases/index#add-support-for-notify_log-for-kubernetes-readiness-probes.)
62
70
 
63
- ### v0.21.0
64
-
65
- - Use `SIGKILL`/`Thread#kill` when the health check fails. In some cases, `SIGTERM` may not be sufficient to terminate a process because the signal can be ignored or the process may be in an uninterruptible state.
66
-
67
- ### v0.20.1
68
-
69
- - Fix compatibility between <code class="language-ruby">Async::Container::Hybrid</code> and the health check.
70
- - <code class="language-ruby">Async::Container::Generic\#initialize</code> passes unused arguments through to <code class="language-ruby">Async::Container::Group</code>.
71
-
72
71
  ## Contributing
73
72
 
74
73
  We welcome contributions to this project.
data/releases.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Releases
2
2
 
3
+ ## v0.27.5
4
+
5
+ - Make the child handling more robust in the face of exceptions.
6
+
7
+ ## v0.27.4
8
+
9
+ - Fix race condition where `wait_for` could modify `@running` while it was being iterated over (`each_value`) during health checks.
10
+
3
11
  ## v0.27.3
4
12
 
5
13
  - Add log for starting child, including container statistics.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-container
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.27.3
4
+ version: 0.27.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file