[#111712] [Ruby master Feature#19322] Support spawning "private" child processes — "kjtsanaktsidis (KJ Tsanaktsidis) via ruby-core" <ruby-core@...>
SXNzdWUgIzE5MzIyIGhhcyBiZWVuIHJlcG9ydGVkIGJ5IGtqdHNhbmFrdHNpZGlzIChLSiBUc2Fu
14 messages
2023/01/07
[ruby-core:111840] [Ruby master Feature#19346] Add Ractor escape hatch Ractor.disable_isolation_checks! { }
From:
"ko1 (Koichi Sasada) via ruby-core" <ruby-core@...>
Date:
2023-01-16 18:21:46 UTC
List:
ruby-core #111840
Issue #19346 has been updated by ko1 (Koichi Sasada).
Status changed from Open to Rejected
This kind of escape hatch can break the Ractor's assumptions so it is not accepted.
For example, we are working on making ractor-local GC and in this case an object can not be reached from other ractors without special sharing logic.
BTW rubygems is thread safe because it uses Mutex (and so on) and this kind of synchronizations are only available in a ractor.
----------------------------------------
Feature #19346: Add Ractor escape hatch Ractor.disable_isolation_checks! { }
https://bugs.ruby-lang.org/issues/19346#change-101252
* Author: luke-gru (Luke Gruber)
* Status: Rejected
* Priority: Normal
----------------------------------------
It would be nice to be able to autoload constants inside Ractors. I'm not sure why this is disabled right now because if autoloading is working properly inside threads
then my initial thought is that the autoload implementation should work inside Ractors.
I guess there's different parts to this:
registering the autoload:
```ruby
Ractor.new { autoload :MyClass, 'myclass' }
```
Kicking off the autoload require
```ruby
Ractor.new { MyClass }
```
This leads to the problem of calling rubygems `require` inside Ractors, as rubygems is not Ractor safe.
However, it's thread-safe so it should be able to be ractor safe too (we don't need the ractor isolation checks in rubygems require).
What if there was an API:
```ruby
Ractor.disable_isolation_checks! do
"..."
end
```
It would disable all Ractor isolation errors inside the block. Rubygems could be patched easily and other gems too that
are thread-safe and use synchronization around the class ivars and constants.
Of course it could be abused and would have to be used properly. Well it's just an idea, I'm sure other people have had the same idea before.
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/