Issue #17366 has been reported by marcandre (Marc-Andre Lafortune).

----------------------------------------
Bug #17366: Ractor odd issue with timeout + receive + sleep + take
https://bugs.ruby-lang.org/issues/17366

* Author: marcandre (Marc-Andre Lafortune)
* Status: Open
* Priority: Normal
* Assignee: ko1 (Koichi Sasada)
* ruby -v: ruby 3.0.0dev (2020-11-30T10:06:25Z master 89774a938a) [x86_64-darwin18]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
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
```



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>