-
Notifications
You must be signed in to change notification settings - Fork 93
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
MiniRacer 0.3.x, 0.4.x hangs on exit after fork #170
Comments
The What can I do to further help investigating this? |
@cataphract any ideas here, this is due to #2b1ee800 I guess |
I'm not sure exactly what part of Is there anything else I can provide to analyse/fix the issue? |
We just committed a patch that will improve things a bit by @cataphract but we are stuck with
(trivial repro is to run bundle exec ruby test/test_forking.rb) The only clean resolution here is to wait on v8 to merge https://chromium-review.googlesource.com/c/v8/v8/+/2416501 and get single thread support going. We could I guess fiddle with exit handlers and force a bypass on v8 exit handlers (which is very yucky and most likely break in spectacular ways) We could possibly shutdown the platform at fork, but that will break a bunch of other stuff. I wish there was an easy fix here, but sadly there is none. |
Thank you for the update. For the time being it's okay for us to stick with the latest version that works for us. I'm not that familiar with the chromium review page, but it states: "merged" - sounds promissing 😀 |
Sorry for a "ping", not wanting to be pushy 🙈 Is there any update to this issue and the single thread support? |
No worries at all, waiting for @lloeki to finish migrating us to node based v8 builds, once that is done we can merge in the mini racer changes. I am quite excited about this, it will be the first library on the planet to support forking of v8 processes. It is quite monumental, even node does not support this. :) |
That merge is a prerequisite to moving forward with fork compatibility (notably because it needed a more recent V8, which we can achieve more easily with |
I see, thanks! btw, I also did some experiments on Linux and arm64 (via Docker on my M1 Mac Mini) and there the problem does not exist. Will do some more investigation in case that's helpful to pin down the issue further. |
I'm going to close this issue as with 0.6.2 and Thanks a lot @lloeki and @SamSaffron 👏 🙇 |
Solved. tl;dr:
MiniRacer::Platform.set_flags!(:single_threaded)
prior to forkingWhile updating mini_racer, we noticed a hang/timeout in our CI. I managed to isolate the issue to our usage of the parallel gem. To trigger the behaviour, I have to use
MiniRacer
first.I am aware that this might be an issue with parallel not mini_racer, but maybe you can help to point out the right direction. Any help is greatly apprechiated! 💕
This is a minimal script to reproduce the issue. It does not seem to happen under macOS (tested on 10.14.6), but is happening e.g. with
docker run -it --rm ruby:2.7.1
. In case you are unfamiliar withparallel
,Parallel.each([1], in_processes: 1) {}
does fork the current process and executes the provided block in parallel (while doing some coordination etc).Some more context: We are using
MiniRacer
for parts of our core business logic, by evaluating user-provided JavaScripts. The parallel gem is used in a totally different and unrelated spot, but it might happen in the same process (e.g. via Sidekiq).Currently broken combinations:
The text was updated successfully, but these errors were encountered: