You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Robin Jansohn (Jira)" <ji...@apache.org> on 2020/10/08 09:28:00 UTC

[jira] [Commented] (CONFIGURATION-794) Unclosed file handle when reading config from JAR file URL

    [ https://issues.apache.org/jira/browse/CONFIGURATION-794?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17210100#comment-17210100 ] 

Robin Jansohn commented on CONFIGURATION-794:
---------------------------------------------

Seems to be Windows specific as we cannot reproduce the behavior when running on Linux...

> Unclosed file handle when reading config from JAR file URL
> ----------------------------------------------------------
>
>                 Key: CONFIGURATION-794
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-794
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 2.7
>            Reporter: Robin Jansohn
>            Priority: Major
>
> We read a properties file which is included in a JAR file. Unfortunately we cannot find any method to close the opened file handle after reading the properties.
> This currently means that the JAR file can only be deleted after the JVM shuts down. I'll open a PR which shows the behavior.
> We currently run our code mostly on Windows systems and Oracle JDK8.
> PR: https://github.com/apache/commons-configuration/pull/76



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Re: [CONFIGURATION-794] Unclosed file handle when reading config from JAR file URL

Posted by Rob Spoor <ap...@icemanx.nl>.
I've found the cause of the issue, in 
sun.net.www.protocol.jar.JarURLConnection$JarURLInputStream. By default 
caching is enabled, so while the JarURLInputStream is closed, the 
JarFile isn't, probably to prevent having to keep opening JAR files.

I've put my findings in JIRA plus a quick fix that may cause other 
issues though; someone may be able to expand on that.

Rob


On 11/10/2020 01:40, Gary Gregory wrote:
> Help needed on this one SVP.
> 
> https://issues.apache.org/jira/browse/CONFIGURATION-794
> 
> Gary
> 
> On Thu, Oct 8, 2020, 05:28 Robin Jansohn (Jira) <ji...@apache.org> wrote:
> 
>>
>>      [
>> https://issues.apache.org/jira/browse/CONFIGURATION-794?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17210100#comment-17210100
>> ]
>>
>> Robin Jansohn commented on CONFIGURATION-794:
>> ---------------------------------------------
>>
>> Seems to be Windows specific as we cannot reproduce the behavior when
>> running on Linux...
>>
>>> Unclosed file handle when reading config from JAR file URL
>>> ----------------------------------------------------------
>>>
>>>                  Key: CONFIGURATION-794
>>>                  URL:
>> https://issues.apache.org/jira/browse/CONFIGURATION-794
>>>              Project: Commons Configuration
>>>           Issue Type: Bug
>>>     Affects Versions: 2.7
>>>             Reporter: Robin Jansohn
>>>             Priority: Major
>>>
>>> We read a properties file which is included in a JAR file. Unfortunately
>> we cannot find any method to close the opened file handle after reading the
>> properties.
>>> This currently means that the JAR file can only be deleted after the JVM
>> shuts down. I'll open a PR which shows the behavior.
>>> We currently run our code mostly on Windows systems and Oracle JDK8.
>>> PR: https://github.com/apache/commons-configuration/pull/76
>>
>>
>>
>> --
>> This message was sent by Atlassian Jira
>> (v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


[CONFIGURATION-794] Unclosed file handle when reading config from JAR file URL

Posted by Gary Gregory <ga...@gmail.com>.
Help needed on this one SVP.

https://issues.apache.org/jira/browse/CONFIGURATION-794

Gary

On Thu, Oct 8, 2020, 05:28 Robin Jansohn (Jira) <ji...@apache.org> wrote:

>
>     [
> https://issues.apache.org/jira/browse/CONFIGURATION-794?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17210100#comment-17210100
> ]
>
> Robin Jansohn commented on CONFIGURATION-794:
> ---------------------------------------------
>
> Seems to be Windows specific as we cannot reproduce the behavior when
> running on Linux...
>
> > Unclosed file handle when reading config from JAR file URL
> > ----------------------------------------------------------
> >
> >                 Key: CONFIGURATION-794
> >                 URL:
> https://issues.apache.org/jira/browse/CONFIGURATION-794
> >             Project: Commons Configuration
> >          Issue Type: Bug
> >    Affects Versions: 2.7
> >            Reporter: Robin Jansohn
> >            Priority: Major
> >
> > We read a properties file which is included in a JAR file. Unfortunately
> we cannot find any method to close the opened file handle after reading the
> properties.
> > This currently means that the JAR file can only be deleted after the JVM
> shuts down. I'll open a PR which shows the behavior.
> > We currently run our code mostly on Windows systems and Oracle JDK8.
> > PR: https://github.com/apache/commons-configuration/pull/76
>
>
>
> --
> This message was sent by Atlassian Jira
> (v8.3.4#803005)
>