-
-
Notifications
You must be signed in to change notification settings - Fork 925
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
FFI memory leak regression #4625
Comments
Seeing this on a large-ish app after ~18 hours of runtime.
|
I'm not sure if this is related, but we've also been seeing an ffi-related memory leak in JRuby 9.1.9.0. The later jnr-ffi versions, starting with 2.1.3, seem to have caused the problem. I filed an issue, jnr/jnr-ffi#117, and possible PR fix, jnr/jnr-ffi#116, for this today. |
Ok, I'm trying to come up with a reasonable test for this, but it's kinda nasty. Unfortunately a simple struct like the one created for |
@headius Did you see the more direct jnr-ffi test case that I included in jnr/jnr-ffi#117? I suppose that one's probably a little lower level than would be useful for testing from JRuby but just wanted to point that out in case you hadn't seen it. |
@camlow325 I had not seen it until now. I just committed a test to JRuby in 6b6f27b, but perhaps your case from jnr/jnr-ffi#117 could be turned into a proper test suite test case? |
Awesome. Thanks for fixing this so fast @camlow325 and @headius! |
FYI, we probably won't be able to spin 9.1.11.0 until mid-June due to folks being out on vacation. But we'll do it as soon as possible! Please test out master and verify that everything looks good for those of you that have had issues. |
Environment
No additional gems installed or loaded.
I discovered this bug in a production service that uses the
posix_spawn()
version of https://github.com/enkessler/childprocess to execute subprocesses.Expected Behavior
I expect JRuby to not run out of memory when repeatedly allocating and freeing a constant number of
FFI::MemoryPointer
objects.In the test script below there is a single thread that allocates and then immediately frees what it allocated. I've run this for several minutes successfully on JRuby 9.1.7.0 and MRI 2.4.1 but on JRuby 9.1.8.0 and 9.1.9.0 it runs out of memory within a few seconds.
Actual Behavior
The JVM runs out of memory after a few seconds. It doesn't look like the native memory allocations are ever freed.
The result of running the above script on JRuby 9.1.9.0:
Just before it crashed the heap histogram looked like this:
The text was updated successfully, but these errors were encountered: