dev@glassfish.java.net

Re: JarFile opening two files

From: kedar <Kedar.Mhaswade_at_Sun.COM>
Date: Wed, 14 Oct 2009 12:01:31 -0700

This is intriguing. I somehow feel that it is the lsof output on non-Solaris
platforms that shows the same file listed twice. For example, Bill, in your case
on Mac, the file descriptor (FD) is reported as 304r (fd/read) and txt (program
code and data) for a file. For me, on Linux, for a similar server
run, lsof shows two rows for a file with FD being mem (memory mapped
file) and 304r (fd/read).
(It does appear however that each entry of lsof output consumes an FD).

So could this really be a JDK bug?


Bill Shannon wrote:
> Interesting. I tried it and I see only one open jar file on Solaris 10.
> I wonder what it is about the other platforms that's causing it to open
> the file more than once?
>
> Are you going to file a JDK bug? If so, let us know.
>
>
> Richard S. Hall wrote on 10/13/09 3:44 AM:
>> 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
>>>
>> ---------------------------------------------------------------------
>> 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
>