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

jffi*.tmp files remain in %TMP% folder #1237

KloppsKopp opened this issue Nov 18, 2013 · 15 comments · Fixed by jnr/jffi#13

jffi*.tmp files remain in %TMP% folder #1237

KloppsKopp opened this issue Nov 18, 2013 · 15 comments · Fixed by jnr/jffi#13


Copy link

@KloppsKopp KloppsKopp commented Nov 18, 2013

Since the 1.7.5 release, every time jruby is instanciated, a new 115kb tempfile prefixed by 'JFFI' is created in the current user's %TMP%-folder and never cleaned up.
This happens on multiple machines, all running windows 7 and oracle's java7 b43 or b10.

Tested with jruby 1.7.5, 6, and 8. Doesn't occur in 1.7.3 and 1.7.4.

It occurs independently of how jruby is invoked on any launch and can lead to large disk pollution in machines that invoke jruby quite often.

Copy link

@filsanet filsanet commented Nov 26, 2013

I came across this issue, and checked my own windows machine. I can verify that this is occuring on Windows underneath 1.7.5. While my machine gets rebooted weekly and %TMP% cleaned out, it could be an issue... seems I have invoked JRuby 250 times in the last 2 days...

Copy link

@headius headius commented Feb 21, 2014

So this only happens on Windows, and it is still happening today, yes?

@headius headius added this to the JRuby 1.7.12 milestone Feb 21, 2014
@headius headius removed this from the JRuby 1.7.10 milestone Feb 21, 2014
Copy link

@enebo enebo commented Feb 21, 2014

I can confirm this is happening and I looked at my old windows box and I
have thousands of jffi copies on it. I don't think this has never not
happened on windows. It should be fixed but the next immediate question is
how we should fix it...

On Fri, Feb 21, 2014 at 1:30 PM, Charles Oliver Nutter <> wrote:

So this only happens on Windows, and it is still happening today, yes?

Reply to this email directly or view it on GitHub

blog: twitter: tom_enebo

@enebo enebo added this to the JRuby 1.7.13 milestone Apr 15, 2014
@enebo enebo removed this from the JRuby 1.7.12 milestone Apr 15, 2014
Copy link

@lolindrath lolindrath commented Apr 19, 2014

I ran all the sample code included in JRuby 1.7.12 windows release on Windows 7 x64 and do not see any jffi files left in my %TMP% directory. I think this bug has been fixed and can be closed now.

Copy link

@enigma69 enigma69 commented Apr 28, 2014

I am running Logstash 1.4.0 on Windows 7 /Windows 2003 and have the same problem. how did you resolve the issue?

Copy link

@areyoutoo areyoutoo commented Apr 30, 2014

@enigma69 It's worth noting that Logstash 1.4.0 is bundled with JRuby 1.7.11; if you go into the vendor folder and swap it out for a newer version such as jruby-complete-1.7.12.jar, do you still see the problem?

Copy link

@enigma69 enigma69 commented May 2, 2014

Yes, I tried this already, but had not joy.

Copy link

@wiibaa wiibaa commented May 16, 2014

I confirm it still occurs with 1.7.12 complete jar, simply running the following create the ffi tmp file:

java -jar jruby-complete-1.7.12.jar -e "require 'ffi'"

@enebo enebo added this to the JRuby 1.7.14 milestone Jun 24, 2014
@enebo enebo removed this from the JRuby 1.7.13 milestone Jun 24, 2014
@enebo enebo removed this from the JRuby 1.7.14 milestone Aug 27, 2014
@enebo enebo added this to the JRuby 1.7.15 milestone Aug 27, 2014
Copy link

@rtyler rtyler commented Dec 3, 2014

This is not actually an issue that is isolated to Windows. It turns out we're seeing it fill up disks in production on Linux! Though I'm sure our use-case is fairly different than the original reporter.

The case that I've discovered this is within redstorm within a running Storm cluster. I've got a Lookout proprietary reproduction (regrettably) using some internal code on JRuby 1.7.15 with the redstorm library which I can share with @mkristian and hope he can derive a better test case out of it.

The gist seems to be that when using some of our code, which I suppose loads ffi through some transitive dependency, then if the embedded ScriptingContainer or JVM exits for some unknown reason (uncaught exception is one example), the /tmp/jffi*.tmp files get left around.

I have a sneaking suspicion that unclean shutdowns of a JRuby ScriptingContainer will cause the issue and that behavior appears to happen rather otten inside of a Storm cluster.

Copy link

@mkristian mkristian commented Dec 4, 2014

hmm - I can reproduce it with this redstorm but still trying to get a nice tiny test-case

@mkristian mkristian added this to the JRuby 1.7.18 milestone Dec 9, 2014
@mkristian mkristian removed this from the JRuby 1.7.15 milestone Dec 9, 2014
Copy link

@mkristian mkristian commented Dec 9, 2014

jffi does copy the native library file from the classloader to a tmp file. and then loads this file. finally this file will be declared as deleteOnExit. especially on windows this is unreliable.

my tests showed:

String lib = "some.native.library";
System.load( lib );
new File(lib).delete();

does work wuite well and matches my experience with linux. no idea about this approach on windows.

on the 1.2.7 tag of patch for would be

diff --git a/src/main/java/com/kenai/jffi/internal/ b/src/main/java/com/kenai/jffi/internal/
index 084b98d..b1bc09b 100644
--- a/src/main/java/com/kenai/jffi/internal/
+++ b/src/main/java/com/kenai/jffi/internal/
@@ -326,6 +326,7 @@ public class StubLoader {

+        dstFile.delete();


that version I ran wuth testsuite on jruby-1_7

the current master of jffi does produce lots of errors.

Copy link

@dialloa dialloa commented Apr 3, 2015

Hi Guys,

Can you please let me know in which version of jruby the issue is fixed?

I am using Logstash, i wan't to replace jruby-complete-1.7.11.jar with the right jar but i could not fine an information giving the right jar version. I downloaded 1.7.19 but not sure if it is fixed as i still have the jffi file created and not removed.


Copy link

@rtyler rtyler commented Apr 3, 2015

@dialloa JRuby 1.7.18

Copy link

@dialloa dialloa commented Apr 3, 2015

Thanks @rtyler Greatly appreciated

Copy link

@perlun perlun commented Feb 11, 2016

Guess what... This bug is back now, in JRuby 9k. Will debug a bit more and then submit an issue (or hopefully, PR).

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

Successfully merging a pull request may close this issue.