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

Closed
KloppsKopp opened this Issue Nov 18, 2013 · 15 comments

Comments

Projects
None yet
@KloppsKopp
Copy link

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.

@filsanet

This comment has been minimized.

Copy link

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...

@headius

This comment has been minimized.

Copy link
Member

commented Feb 21, 2014

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

@headius headius modified the milestones: JRuby 1.7.12, JRuby 1.7.10 Feb 21, 2014

@enebo

This comment has been minimized.

Copy link
Member

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 <
notifications@github.com> wrote:

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

Reply to this email directly or view it on GitHubhttps://github.com//issues/1237#issuecomment-35764551
.

blog: http://blog.enebo.com twitter: tom_enebo
mail: tom.enebo@gmail.com

@enebo enebo modified the milestones: JRuby 1.7.13, JRuby 1.7.12 Apr 15, 2014

@lolindrath

This comment has been minimized.

Copy link

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.

@enigma69

This comment has been minimized.

Copy link

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?

@areyoutoo

This comment has been minimized.

Copy link

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?

@enigma69

This comment has been minimized.

Copy link

commented May 2, 2014

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

@wiibaa

This comment has been minimized.

Copy link

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 modified the milestones: JRuby 1.7.14, JRuby 1.7.13 Jun 24, 2014

@enebo enebo modified the milestones: JRuby 1.7.14, JRuby 1.7.15 Aug 27, 2014

@rtyler rtyler added core in progress and removed windows labels Dec 3, 2014

@rtyler

This comment has been minimized.

Copy link

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.

@mkristian

This comment has been minimized.

Copy link
Member

commented Dec 4, 2014

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

@mkristian mkristian modified the milestones: JRuby 1.7.18, JRuby 1.7.15 Dec 9, 2014

@mkristian

This comment has been minimized.

Copy link
Member

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 https://github.com/jnr/jffi would be

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

         System.load(dstFile.getAbsolutePath());
+        dstFile.delete();
     }

     /**

that version I ran wuth testsuite on jruby-1_7

the current master of jffi does produce lots of errors.

@dialloa

This comment has been minimized.

Copy link

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.

Thanks,
Abdoul

@rtyler

This comment has been minimized.

Copy link

commented Apr 3, 2015

@dialloa

This comment has been minimized.

Copy link

commented Apr 3, 2015

Thanks @rtyler Greatly appreciated

@perlun

This comment has been minimized.

Copy link
Contributor

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
You can’t perform that action at this time.