[ruby-core:105058] [Ruby master Bug#18129] Ractor-incompatible global variables can be accessed through alias
From:
"rm155 (Rohit Menon)" <noreply@...>
Date:
2021-08-23 22:08:23 UTC
List:
ruby-core #105058
Issue #18129 has been reported by rm155 (Rohit Menon). ---------------------------------------- Bug #18129: Ractor-incompatible global variables can be accessed through alias https://bugs.ruby-lang.org/issues/18129 * Author: rm155 (Rohit Menon) * Status: Open * Priority: Normal * Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN ---------------------------------------- Some global variables are not allowed in non-main Ractors. For example, the following code does not run: ``` ruby Ractor.new do $/ end.take #=> can not access global variables $/ from non-main Ractors (Ractor::IsolationError) ``` This error message is expected because $/ is not allowed outside the main Ractor. However, if the variable is aliased, it sometimes bypasses this. For example, the following code sometimes runs unexpectedly without error: ``` ruby alias $alias_global_variable $/ Ractor.new do $alias_global_variable end.take ``` Sometimes, it correctly fails with the message “can not access global variables $alias_global_variable from non-main Ractors (Ractor::IsolationError)”. However, because the global variable is sometimes accessed without error, this could lead to data races. -- 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>