async-container 0.34.4 → 0.35.0

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: 45d1096677e99abf4e408324f81089d3a09dffe06faec9802505f0982a286c9c
4
- data.tar.gz: 9297103dfdd8c2181881a7cc6639afcc4d16ea3acfcd4f6074429c6a06c229f5
3
+ metadata.gz: 047d770adce55a53f648a828ac9e1b4694598d8815d06c271cb293b31829ac90
4
+ data.tar.gz: d54a1bda7d25bd2d33b72c62ea0722a8c82a3a68045b1cae529ed149d37e5ea8
5
5
  SHA512:
6
- metadata.gz: c1e6e6c690ab46402878c54a91565decb35a5cfbb6f10b49e393949fafe2cba33da780bbdbb9a2b01dd9ad80487a16e83c7188667f22ee6e8c8696008a0e8ce2
7
- data.tar.gz: fce543a64ebb908baa70bd0c5912b92b1395e3a99fc257cc3280cd3527f23215001e1aebfa50946f6fd956011f981b84e92a8ced7d4079e063fa9be542d1e8c6
6
+ metadata.gz: 5175d784347c33381f3014ce30845448890b6074ddb606861877fb23937a1afcdf0d776dd70d5f700498de4b09e59560936b78f59d0b3b2f2bf9b96d132efa24
7
+ data.tar.gz: c5e130f7dd4723935e9ae95f3aebb63dcea17aba57c2a995a5bb5ac4085973e63b5c1bf3dfb79d9ea79dd20b3a017be9b7f38937babe4f09ac7c6135f44f7300
checksums.yaml.gz.sig CHANGED
Binary file
@@ -80,13 +80,15 @@ module Async
80
80
  # This method replaces the child process with the new executable, thus this method never returns.
81
81
  #
82
82
  # @parameter arguments [Array] The arguments to pass to the new process.
83
- # @parameter ready [Boolean] If true, informs the parent process that the child is ready. Otherwise, the child process will need to use a notification protocol to inform the parent process that it is ready.
83
+ # @parameter ready [Boolean] If true, informs the parent process that the child is ready before exec. The notification pipe will still be passed to the exec'd process to prevent premature termination.
84
84
  # @parameter options [Hash] Additional options to pass to {::Process.exec}.
85
85
  def exec(*arguments, ready: true, **options)
86
+ # Always set up the notification pipe to be inherited by the exec'd process.
87
+ # This prevents the pipe from closing, which would trigger hang prevention and SIGKILL.
88
+ self.before_spawn(arguments, options)
89
+
86
90
  if ready
87
91
  self.ready!(status: "(exec)")
88
- else
89
- self.before_spawn(arguments, options)
90
92
  end
91
93
 
92
94
  ::Process.exec(*arguments, **options)
@@ -115,6 +115,11 @@ module Async
115
115
  @group.wait
116
116
  end
117
117
 
118
+ # Gracefully interrupt all child instances.
119
+ def interrupt
120
+ @group.interrupt
121
+ end
122
+
118
123
  # Returns true if all children instances have the specified status flag set.
119
124
  # e.g. `:ready`.
120
125
  # This state is updated by the process readiness protocol mechanism. See {Notify::Client} for more details.
@@ -31,14 +31,15 @@ module Async
31
31
  container.wait_until_ready
32
32
  instance.ready!
33
33
 
34
- container.wait
35
- rescue Async::Container::Terminate
36
- # Stop it immediately:
37
- container.stop(false)
38
- raise
34
+ begin
35
+ container.wait
36
+ rescue Interrupt
37
+ # Gracefully interrupt child threads; parent process handles escalation.
38
+ container.interrupt
39
+ retry
40
+ end
39
41
  ensure
40
- # Stop it gracefully (also code path for Interrupt):
41
- container.stop
42
+ container.stop(false)
42
43
  end
43
44
  end
44
45
 
@@ -91,10 +91,11 @@ module Async
91
91
  # Execute a child process using {::Process.spawn}. In order to simulate {::Process.exec}, an {Exit} instance is raised to propagage exit status.
92
92
  # This creates the illusion that this method does not return (normally).
93
93
  def exec(*arguments, ready: true, **options)
94
+ # Always set up the notification pipe to be inherited by the spawned process.
95
+ self.before_spawn(arguments, options)
96
+
94
97
  if ready
95
98
  self.ready!(status: "(spawn)")
96
- else
97
- self.before_spawn(arguments, options)
98
99
  end
99
100
 
100
101
  begin
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Async
7
7
  module Container
8
- VERSION = "0.34.4"
8
+ VERSION = "0.35.0"
9
9
  end
10
10
  end
data/readme.md CHANGED
@@ -28,6 +28,14 @@ Please see the [project documentation](https://socketry.github.io/async-containe
28
28
 
29
29
  Please see the [project releases](https://socketry.github.io/async-container/releases/index) for all releases.
30
30
 
31
+ ### v0.35.0
32
+
33
+ - **Fixed**: `Hybrid` now interrupts inner threaded children during graceful shutdown and force-stops remaining children on exit.
34
+
35
+ ### v0.34.5
36
+
37
+ - **Fixed**: `instance.exec` with `ready: true` no longer causes premature termination. The notification pipe is now always passed to the exec'd process.
38
+
31
39
  ### v0.34.4
32
40
 
33
41
  - Add missing `bake` and `context` files to the release.
@@ -63,15 +71,6 @@ Please see the [project releases](https://socketry.github.io/async-container/rel
63
71
  - Add `Async::Container::Statistics::Rate` for tracking failure and restart rates over sliding time windows.
64
72
  - Fix restart counter to only increment when actually restarting (check `@running` flag).
65
73
 
66
- ### v0.30.0
67
-
68
- - `SIGTERM` is now graceful, the same as `SIGINT`, for better compatibility with Kubernetes and systemd.
69
- - `ASYNC_CONTAINER_INTERRUPT_TIMEOUT` and `ASYNC_CONTAINER_TERMINATE_TIMEOUT` are removed and replaced by `ASYNC_CONTAINER_GRACEFUL_TIMEOUT`.
70
-
71
- ### v0.29.0
72
-
73
- - Introduce `Client#healthy!` for sending health check messages.
74
-
75
74
  ## Contributing
76
75
 
77
76
  We welcome contributions to this project.
@@ -82,6 +81,22 @@ We welcome contributions to this project.
82
81
  4. Push to the branch (`git push origin my-new-feature`).
83
82
  5. Create new Pull Request.
84
83
 
84
+ ### Running Tests
85
+
86
+ To run the test suite:
87
+
88
+ ``` shell
89
+ bundle exec sus
90
+ ```
91
+
92
+ ### Making Releases
93
+
94
+ To make a new release:
95
+
96
+ ``` shell
97
+ bundle exec bake gem:release:patch # or minor or major
98
+ ```
99
+
85
100
  ### Developer Certificate of Origin
86
101
 
87
102
  In order to protect users of this project, we require all contributors to comply with the [Developer Certificate of Origin](https://developercertificate.org/). This ensures that all contributions are properly licensed and attributed.
data/releases.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Releases
2
2
 
3
+ ## v0.35.0
4
+
5
+ - **Fixed**: `Hybrid` now interrupts inner threaded children during graceful shutdown and force-stops remaining children on exit.
6
+
7
+ ## v0.34.5
8
+
9
+ - **Fixed**: `instance.exec` with `ready: true` no longer causes premature termination. The notification pipe is now always passed to the exec'd process.
10
+
3
11
  ## v0.34.4
4
12
 
5
13
  - Add missing `bake` and `context` files to the release.
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.34.4
4
+ version: 0.35.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -113,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
113
  - !ruby/object:Gem::Version
114
114
  version: '0'
115
115
  requirements: []
116
- rubygems_version: 4.0.6
116
+ rubygems_version: 4.0.10
117
117
  specification_version: 4
118
118
  summary: Abstract container-based parallelism using threads and processes where appropriate.
119
119
  test_files: []
metadata.gz.sig CHANGED
Binary file