-
Notifications
You must be signed in to change notification settings - Fork 609
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
rbx consumes 100% of CPU when use FFI #3395
Comments
@testors are you using C-ext Readline or rb-readline? |
@testors the behavior you are seeing results from two things, one I can change easily and one that takes a bit more work and thought: 1) we are stopping all threads to check if we should run the GC; and 2) the thread making an FFI call (ie calling into some sort of native code) is still marked as GC-dependent, so when it blocks, the whole process will block as soon as a GC is triggered. The first one is easy to remove. A GC event is much less common than not, so we do a simple check and re-check after check-pointing. We check for a pending GC all the time, so a false negative has no bad consequence. The second is more complicated because if we mark the thread executing an FFI call as GC-independent, we need to ensure that any re-entry to managed code marks the thread as GC-dependent (and possibly blocks waiting for an existing GC run to complete). A more complex issue is ensuring that no concurrent mutator or GC activity could invalidate any assumptions that may exist for the native code that is executing in the GC-independent thread. |
Rubinius will continue to maintain compatibility with the current stable version of MRI to the extent possible. The focus for Rubinius in the near term is on the following capabilities:
Contributions in the form of PRs for any of the areas of focus above, or for Ruby compatibility, are appreciated. |
sleep.c
sleep.rb
How to reproduce :
jruby works well.
The text was updated successfully, but these errors were encountered: