Project

General

Profile

Actions

Bug #17366

closed

Ractor odd issue with timeout + receive + sleep + take

Added by marcandre (Marc-Andre Lafortune) over 3 years ago. Updated over 3 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 3.0.0dev (2020-11-30T10:06:25Z master 89774a938a) [x86_64-darwin18]
[ruby-core:101246]

Description

I believe the following behavior is incorrect:

ruby -r timeout -e 'r = Ractor.new { Timeout.timeout(0.1) { sleep(1)       } rescue :timeout };             p r.take'
# => :timeout (ok)

ruby -r timeout -e 'r = Ractor.new { Timeout.timeout(0.1) { sleep(1)       } rescue :timeout }; sleep(0.2); p r.take'
# => :timeout (ok)

ruby -r timeout -e 'r = Ractor.new { Timeout.timeout(0.1) { Ractor.receive } rescue :timeout };             p r.take'
# => :timeout (ok)

ruby -r timeout -e 'r = Ractor.new { Timeout.timeout(0.1) { Ractor.receive } rescue :timeout }; sleep(0.2); p r.take'
<internal:ractor>:130:in `take': The outgoing-port is already closed (Ractor::ClosedError) # => not ok
Actions

Also available in: Atom PDF

Like0
Like0Like0