-
Notifications
You must be signed in to change notification settings - Fork 15
Etc is not Ractor-safe currently #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
8d11ad1 to
389d709
Compare
|
I think methods from |
Agreed, so I marked those as Ractor-safe and the rest as Ractor-unsafe, and added tests. |
ext/etc/etc.c
Outdated
| rb_define_module_function(mEtc, "uname", etc_uname, 0); | ||
| rb_define_module_function(mEtc, "sysconf", etc_sysconf, 1); | ||
| rb_define_module_function(mEtc, "confstr", etc_confstr, 1); | ||
| rb_define_method(rb_cIO, "pathconf", io_pathconf, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these 3 are probably MT-safe, and possibly also pathconf.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I'll add them.
And systmpdir seems fine too, all functions it calls take a buffer (for the path) so should be thread-safe.
I'll add a test calling these functions in parallel to try to ensure they are indeed thread/Ractor-safe.
Feel free to review more functions and mark them as safe later, I would just recommend to add them to test_ractor_parallel to check if they are indeed thread/Ractor-safe.
Actually sysconfdir doesn't work in a Ractor: https://github.com/ruby/ruby/actions/runs/14069312270/job/39399502142#step:12:941 because it tries to access RbConfig::CONFIG if |
|
Unfortunately there are more problems, which might be in Etc functions or Ractor bugs. I have seen this failure: Mentioned in https://ruby.slack.com/archives/C02A3SL0S/p1743044607025709 |
I think this makes sense for now to address the segfault.
Of course it can be improved later to use explicit locking.