Skip to content

Commit d51485d

Browse files
committed
Handle situation where a closed ractor results in an IOError
1 parent 48068cf commit d51485d

4 files changed

Lines changed: 13 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [0.0.7] - 2026-06-06
2+
3+
- Closed Ractor::Ports sometimes give IOError instead of Ractor::ClosedError so handle both
4+
15
## [0.0.6] - 2026-06-06
26

37
- Fix a bug where a closed port mysteriously breaks out of Kernel#loop

Gemfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
ractorize (0.0.6)
4+
ractorize (0.0.7)
55

66
GEM
77
remote: https://rubygems.org/
@@ -208,7 +208,7 @@ CHECKSUMS
208208
pry-byebug (3.12.0) sha256=594e094ae8a8390a7ad4c7b36ae36e13304ed02664c67417d108dc5f7213d1b7
209209
psych (5.4.0) sha256=14f72d69a611af663d7d70e4a7b67d9eb1f3ae9f8d916b478961d5a0075ba5b7
210210
racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
211-
ractorize (0.0.6)
211+
ractorize (0.0.7)
212212
rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a
213213
rake (13.4.2) sha256=cb825b2bd5f1f8e91ca37bddb4b9aaf345551b4731da62949be002fa89283701
214214
rb-fsevent (0.11.2) sha256=43900b972e7301d6570f64b850a5aa67833ee7d87b458ee92805d56b7318aefe

src/ractorize.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,12 @@ def extract_args(port_like)
275275

276276
begin
277277
return_port.send(value)
278+
rescue IOError => e
279+
# Unclear why this sometimes manifests as this error instead of ClosedError but
280+
# need to handle them both.
281+
# :nocov:
282+
raise unless e.message == "closed stream"
283+
# :nocov:
278284
rescue Ractor::ClosedError
279285
# Whoa... this error inherits from StopIteration and will kill the loop!!!
280286
# Nothing really to do here but keep the loop going and handle other

version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module Ractorize
2-
VERSION = "0.0.6".freeze
2+
VERSION = "0.0.7".freeze
33
MINIMUM_RUBY_VERSION = ">= 4.0.0".freeze
44
end

0 commit comments

Comments
 (0)