legion-transport 1.4.26 → 1.4.27

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: 3ef4fe3fdbefc12a9efd791c71b41422435c5ad5401e5ba0c51040649360f0b0
4
- data.tar.gz: 8162f75c0d55ec521e8e1f3e2eaa1ff367b16bd0479a5c4f46471d9a6a92f8db
3
+ metadata.gz: 34f1262388f94d320591c4626c44d07d7da821d89d0ccf7667daa6447c21902d
4
+ data.tar.gz: 47bb88de9f7f28684dee8b96fe62d91eca3c766bd232bcf895a1cf7426482037
5
5
  SHA512:
6
- metadata.gz: 577f95777048496f3155dc4e22a9fd865df45fe1869c076e7297dcd2390352d3929952b0fa849e5864974ad84b2595a28d3788f8bdfe50a9a3f55084f3fb535c
7
- data.tar.gz: 96cda6bf47f5bfa71ef6e3684b1ea68ebe91573159d42e00adba7f6f664d9f1bc0a587a185abfd5108dbe60f77bbe6e598c61a7a4929b971aca24c7ccf128707
6
+ metadata.gz: 9bbc69ae6b29a4ce61f47d81b326b7ff5f915939bbc88702c8e7df2f52fd9bb9cf9e1f155659d1b294ece6e0ab9cac56694d8ca8f5920f7938c6eec35942e7c2
7
+ data.tar.gz: 1e989cbb8273f1877f35b264512269e6d8ba5db1180153c2b2f8cff169c15005c76ee1390bd5d6c4cff97267dad65840b6cd2d28f2abbe9a815d85e2d7b4b5e3
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [1.4.27] - 2026-05-17
6
+
7
+ ### Fixed
8
+ - Fixed race condition in channel registry iteration: `sweep_dead_thread_channels` and `close_all_tracked_channels` used `.each` on the live hash while parallel boot threads (`hook_subscription_actors_pooled`) concurrently called `track_channel`, raising `"can't add a new key into hash during iteration"` on Ruby 3.4. Replaced with `.keys.each` which snapshots the key list into an Array before iterating.
9
+
5
10
  ## [1.4.26] - 2026-05-16
6
11
 
7
12
  ### Fixed
@@ -301,12 +301,12 @@ module Legion
301
301
  @channel_registry ||= Concurrent::Hash.new
302
302
  return if @channel_registry.empty?
303
303
 
304
- @channel_registry.each_value do |channel|
305
- channel.close if channel&.open?
304
+ @channel_registry.keys.each do |thread| # rubocop:disable Style/HashEachMethods
305
+ channel = @channel_registry.delete(thread)
306
+ channel&.close if channel&.open?
306
307
  rescue StandardError => e
307
308
  handle_exception(e, level: :warn, handled: true, operation: 'transport.connection.close_tracked_channel')
308
309
  end
309
- @channel_registry.clear
310
310
  end
311
311
 
312
312
  def sweep_dead_thread_channels
@@ -314,14 +314,16 @@ module Legion
314
314
  return if @channel_registry.empty?
315
315
 
316
316
  swept = 0
317
- @channel_registry.each do |thread, channel|
317
+ @channel_registry.keys.each do |thread| # rubocop:disable Style/HashEachMethods
318
318
  next if thread&.alive?
319
319
 
320
- if channel&.open?
320
+ channel = @channel_registry.delete(thread)
321
+ next unless channel
322
+
323
+ if channel.open?
321
324
  channel.close
322
325
  swept += 1
323
326
  end
324
- @channel_registry.delete(thread)
325
327
  rescue StandardError => e
326
328
  @channel_registry.delete(thread)
327
329
  handle_exception(e, level: :warn, handled: true, operation: 'transport.connection.sweep_channel')
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Legion
4
4
  module Transport
5
- VERSION = '1.4.26'
5
+ VERSION = '1.4.27'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: legion-transport
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.26
4
+ version: 1.4.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity