async-container-supervisor 0.9.2 → 0.10.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: 9013912b7ef22165d93ebf5f6958d26be67b99f601a28b3ac6e7208fc4e8db54
4
- data.tar.gz: 2de566c74dc9fabad2bc5ccb0f0bf329581860fbb8e27f14944cefecfacef9b2
3
+ metadata.gz: a87a996e93046c794d475b25431d6903f6e47959e68f3b2474c0f6cf0121e166
4
+ data.tar.gz: 431e6f20a8945047cf240c8a1aef5f825cac8d6f2a75d1023825364ad27d7cbd
5
5
  SHA512:
6
- metadata.gz: bde00386e4f3faa439e149b872bb22075725f05235769a1b5084760f059e0e1aed7a669dec9232125aa5053b1afdf09a016c444a16918c4da92210169e9e50b0
7
- data.tar.gz: 844be24d31216db2cdfb978aaf888d15be0982e3211c384e7239bd564ef08880d5d870d887084319232ce6760594b37974623c11c5686c433c92ae3de960e67d
6
+ metadata.gz: b78a271e703940ef965db230e8d5535e2d06fda09310e4234a8248bfbaa6c2102d95e2f342d459a5c79adf793ec269d645cb9a6acc426d2a11516426e34cd9cd
7
+ data.tar.gz: 867632686896a3438f6c0153bd1fa1a7c96e6c470e07a06655e0562b8cae9cbb53264e1852c8cee420c59793f83cce1ecc438aa3d16a1a49d71a65a0b8329b3c
checksums.yaml.gz.sig CHANGED
Binary file
@@ -20,9 +20,9 @@ module Async
20
20
  # @parameter interval [Integer] The interval at which to check for memory leaks.
21
21
  # @parameter total_size_limit [Integer] The total size limit of all processes, or nil for no limit.
22
22
  # @parameter options [Hash] Options to pass to the cluster when adding processes.
23
- def initialize(interval: 10, total_size_limit: nil, memory_sample: false, **options)
23
+ def initialize(interval: 10, total_size_limit: nil, free_size_minimum: nil, memory_sample: false, **options)
24
24
  @interval = interval
25
- @cluster = Memory::Leak::Cluster.new(total_size_limit: total_size_limit)
25
+ @cluster = Memory::Leak::Cluster.new(total_size_limit: total_size_limit, free_size_minimum: free_size_minimum)
26
26
 
27
27
  @memory_sample = memory_sample
28
28
 
@@ -30,6 +30,9 @@ module Async
30
30
  @options = options
31
31
 
32
32
  @processes = Hash.new{|hash, key| hash[key] = Set.new.compare_by_identity}
33
+
34
+ # Queue to serialize cluster modifications to prevent race conditions:
35
+ @guard = Mutex.new
33
36
  end
34
37
 
35
38
  # @attribute [Memory::Leak::Cluster] The cluster of processes being monitored.
@@ -50,7 +53,10 @@ module Async
50
53
 
51
54
  if connections.empty?
52
55
  Console.debug(self, "Registering process.", child: {process_id: process_id})
53
- self.add(process_id)
56
+ # Queue the cluster modification to avoid race conditions:
57
+ @guard.synchronize do
58
+ self.add(process_id)
59
+ end
54
60
  end
55
61
 
56
62
  connections.add(connection)
@@ -66,7 +72,9 @@ module Async
66
72
 
67
73
  if connections.empty?
68
74
  Console.debug(self, "Removing process.", child: {process_id: process_id})
69
- @cluster.remove(process_id)
75
+ @guard.synchronize do
76
+ @cluster.remove(process_id)
77
+ end
70
78
  end
71
79
  end
72
80
  end
@@ -119,14 +127,16 @@ module Async
119
127
  def run
120
128
  Async do
121
129
  Loop.run(interval: @interval) do
122
- # This block must return true if the process was killed.
123
- @cluster.check! do |process_id, monitor|
124
- Console.error(self, "Memory leak detected!", child: {process_id: process_id}, monitor: monitor)
125
-
126
- begin
127
- memory_leak_detected(process_id, monitor)
128
- rescue => error
129
- Console.error(self, "Failed to handle memory leak!", child: {process_id: process_id}, exception: error)
130
+ @guard.synchronize do
131
+ # This block must return true if the process was killed.
132
+ @cluster.check! do |process_id, monitor|
133
+ Console.error(self, "Memory leak detected!", child: {process_id: process_id}, monitor: monitor)
134
+
135
+ begin
136
+ memory_leak_detected(process_id, monitor)
137
+ rescue => error
138
+ Console.error(self, "Failed to handle memory leak!", child: {process_id: process_id}, exception: error)
139
+ end
130
140
  end
131
141
  end
132
142
  end
@@ -9,7 +9,7 @@ module Async
9
9
  module Container
10
10
  # @namespace
11
11
  module Supervisor
12
- VERSION = "0.9.2"
12
+ VERSION = "0.10.0"
13
13
  end
14
14
  end
15
15
  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-supervisor/releases/index) for all releases.
28
28
 
29
+ ### v0.10.0
30
+
31
+ - Add support for `Memory::Leak::Cluster` `free_size_minimum:`.
32
+
33
+ ### v0.9.3
34
+
35
+ - Serialize `register`/`remove` and `check!` operations in `MemoryMonitor`.
36
+
29
37
  ### v0.9.1
30
38
 
31
39
  - Close `Call` queue if asynchronous call fails during dispatch - further messages will fail with `ClosedQueueError`.
@@ -62,10 +70,6 @@ Please see the [project releases](https://socketry.github.io/async-container-sup
62
70
 
63
71
  - Add `async:container:supervisor:reload` command to restart the container (blue/green deployment).
64
72
 
65
- ### v0.1.0
66
-
67
- - Initial implementation.
68
-
69
73
  ## Contributing
70
74
 
71
75
  We welcome contributions to this project.
data/releases.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Releases
2
2
 
3
+ ## v0.10.0
4
+
5
+ - Add support for `Memory::Leak::Cluster` `free_size_minimum:`.
6
+
7
+ ## v0.9.3
8
+
9
+ - Serialize `register`/`remove` and `check!` operations in `MemoryMonitor`.
10
+
3
11
  ## v0.9.1
4
12
 
5
13
  - Close `Call` queue if asynchronous call fails during dispatch - further messages will fail with `ClosedQueueError`.
data.tar.gz.sig CHANGED
@@ -1,2 +1,2 @@
1
- )X��&!�$l@ v���8�� a�u6<QF!��[�` �Xm��6�&,'�F���W�, $��i�|��S6
2
- ����2�4��!RT�.S��%,eP�@����G{r7gT˖����e���nc�#_�N[\�Y#�- ��I0��l��5�����B�NdO;9��_�����/�$����oF!M>�=F^L� �ľ$7��V��w�'e�T�B�����*bl�Z��^��:Td���-7N������+,7i�4[M��.]���O|���2slA��u�����yK�3�O���U �������sG+�$Bf��=j)M AM]66���O�OAKbyh;j�d�%d�V�[hs[4�tt}�Zo`A)�.
1
+ FNz^��N}S����%\�|r�� ������
2
+ Kn�0�^���@|� �����ypVDA䝼,kJӜ���}���01a2�9�S��3��Y8}p�L��щ���z��^p�&-�L8jN�{�ڿ���� 2l"��@�f6���Pz�*��pZ,@e &��g��+�11:�)58E�u56
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-container-supervisor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0.5'
89
+ version: '0.10'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0.5'
96
+ version: '0.10'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: process-metrics
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -154,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
154
  - !ruby/object:Gem::Version
155
155
  version: '0'
156
156
  requirements: []
157
- rubygems_version: 3.6.9
157
+ rubygems_version: 4.0.3
158
158
  specification_version: 4
159
159
  summary: A supervisor for managing multiple container processes.
160
160
  test_files: []
metadata.gz.sig CHANGED
Binary file