dev@glassfish.java.net

JarFile opening two files (was: Re: is quicklook working right now?)

From: Richard S. Hall <heavy_at_ungoverned.org>
Date: Tue, 13 Oct 2009 12:44:34 +0200

Well, here is the test program I wrote:

     package test;
     import java.util.jar.JarFile;
     public class Main {
         public static void main(String[] args) throws Exception {
             JarFile jar = new JarFile("test.jar");
             System.out.println("+++ AFTER");
             Thread.sleep(120000);
         }
     }

Under Windows test.jar appears to be opened twice using handle.exe:

java.exe pid: 3992 HEAVYWEIGHT-XP\rickhall
   694: File (RW-) C:\Documents and
Settings\rickhall\Projects\tmp\test.jar
   698: File (RW-) C:\Documents and
Settings\rickhall\Projects\tmp\test.jar

Under Snow Leopard test.jar appears to be opened twice using lsof:

java 27559 rickhall 30r REG 14,2 938 35110250
/Users/rickhall/tmp/test.jar
java 27559 rickhall 31r REG 14,2 938 35110250
/Users/rickhall/tmp/test.jar

Under Linux test.jar appears to be opened twice using lsof:

java 2527 rickhall 4r REG 253,0 949 508106
/home/rickhall/test.jar
java 2527 rickhall 5r REG 253,0 949 508106
/home/rickhall/test.jar

So, it doesn't appear to be specific to the Mac. Part of me wonders if
this is just some confusion in how these utilities report open file...

I actually tried to test it on OpenSolaris too. That was a little more
complicated and I don't know if I was successful or not, but in that
case it seems like I only saw one open file.

-> richard

On 10/13/09 0:19, Richard S. Hall wrote:
> Ok, before reporting this, I will check on a couple other platforms
> (e.g., Linux and Windows) to make sure it isn't Mac OS specific.
>
> -> richard
>
> On 10/12/09 23:42, Jeanfrancois Arcand wrote:
>>
>>
>> Bill Shannon wrote:
>>> Richard S. Hall wrote on 10/11/09 4:41 AM:
>>>> I set a break point where Felix opens the the first bundle JAR file
>>>> using JarFile. Before creating the JarFile there was no open bundle
>>>> JAR
>>>> files, after it there were two. I even created a simple test program
>>>> that only opens a JarFile in its main method and sleeps for 30
>>>> seconds.
>>>> This is what I saw:
>>>>
>>>> java 14129 rickhall 30r REG 14,2 846 43270278
>>>> /Users/rickhall/tmp/jar/jar.jar
>>>> java 14129 rickhall 31r REG 14,2 846 43270278
>>>> /Users/rickhall/tmp/jar/jar.jar
>>>>
>>>> So, it seems JarFile always reports two open files. Not sure why.
>>>
>>> So, I guess it's a bug, or feature, of the JDK.
>>>
>>> Maybe you should file a bug and see what they say? You might want
>>> to search the bug database first.
>>
>> FYI I've talked with the SE team and it seems it is not a known issue
>> (at least based on this email thread). In any case we should document
>> the fact that GF needs more than the usual default fd to runs
>> properly, because we will ends up with tons of post on 'GlassFish
>> leaks fd' :-)
>>
>> -- Jeanfrancois
>>
>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>