Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set
rb_ext_ractor_safe(true)
to avoid breakages from removing loader
This was an interesting one... Once we removed the profiling loader extension, our tests using Ractors started failing with: > Ractor::UnsafeError: ractor unsafe method called from not main ractor When I started investigating with gdb, I discovered that because we were initializing our extension without going through Ruby, we were skipping this part: https://github.com/ruby/ruby/blob/7178593558080ca529abb61ef27038236ab2687d/load.c#L1301-L1302 : ```c ext_config_push(th, &prev_ext_config); handle = rb_vm_call_cfunc(rb_vm_top_self(), load_ext, path, VM_BLOCK_HANDLER_NONE, path); ``` that is, the `ext_config_push` is what's used by Ruby to validate if a gem is safe to use from Ractors or not. (If you're curious, that value then affects function definition, which controls wether Ruby will check or not for being called from a Ractor). Because we were skipping this entire mechanism, we implicitly were getting the same result as `rb_ext_ractor_safe(true)`. Once we removed the loader, this started failing. And I missed it before opening my PR since for reasons documented in the profiler ractor tests in detail, we don't run ractor-related tests by default. So this issue is one more reason why having the loader may create its own set of issues and why I'm happy to get rid of it.
- Loading branch information