[#109207] [Ruby master Feature#18915] New error class: NotImplementedYetError or scope change for NotImplementedYet — Quintasan <noreply@...>
Issue #18915 has been reported by Quintasan (Michał Zając).
18 messages
2022/07/14
[ruby-core:109354] [Ruby master Bug#18933] Dir.tmpdir implemented in non-Ractor-safe manner
From:
"kreynolds (Kelley Reynolds)" <noreply@...>
Date:
2022-07-28 11:57:39 UTC
List:
ruby-core #109354
Issue #18933 has been updated by kreynolds (Kelley Reynolds).
File tmpdir.diff added
Attached is a possible solution for this
----------------------------------------
Bug #18933: Dir.tmpdir implemented in non-Ractor-safe manner
https://bugs.ruby-lang.org/issues/18933#change-98498
* Author: kreynolds (Kelley Reynolds)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin21]
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
# Background
Inside a Ractor, it is expected that generating a temporary directory using `Dir.tmpdir` will work. The current implementation uses a number of things which are not considered Rector-safe and will require refactoring.
# How to reproduce
```ruby
Ractor.new { Dir.tmpdir }
```
# Expectation and result
The result is expected to be something along the lines of `"/var/folders/xm/y4c00x0s26sgf_zlnqjh_7800000gn/T"` but instead a `Ractor::IsolationError` exception is raised:
```ruby
3.1.2/lib/ruby/3.1.0/tmpdir.rb:23:in `tmpdir': can not access class variables from non-main Ractors (Ractor::IsolationError)
```
# Suggested solutions
* Make cached class variable a shareable constant
* Modify how random values are generated to be Rector-safe
---Files--------------------------------
tmpdir.diff (1.77 KB)
--
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>