Skip to content
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

Override Process._fork? #324

Open
jamiemccarthy opened this issue Dec 22, 2024 · 1 comment
Open

Override Process._fork? #324

jamiemccarthy opened this issue Dec 22, 2024 · 1 comment

Comments

@jamiemccarthy
Copy link

Hi, I just noticed this note in the README from 2019 (Ruby 2.6):

https://github.com/rubyjs/mini_racer?tab=readme-ov-file#fork-safety

In 2021, Ruby 3.1 was released with the addition of Process._fork:

https://bugs.ruby-lang.org/issues/17795

_fork is meant to be patched, so code that needs a performant notification at fork time can make the necessary changes at that time, without having to poll.

Ruby 3.0 is EOL (and 3.1 will be soon), so every supported Ruby should have this method.

Is it worthwhile to try patching _fork and making use of that?

@tisba
Copy link
Collaborator

tisba commented Dec 23, 2024

Good point. mini_racer only supports non-EOL'd Rubies, so like you said, we should be good on that front.

I'm not 100% sure how reliable an "automatic" solution could be, but it's definitely worth updating the README section.

That being said, for our use case, where we are forking and using mini_racer, MiniRacer::Platform.set_flags!(:single_threaded) has proven to be quite reliable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants