[
https://issues.jboss.org/browse/JBRULES-3651?page=com.atlassian.jira.plug...
]
Chris Rankin updated JBRULES-3651:
----------------------------------
Steps to Reproduce:
{code}URL jarURL = new URL("jar:file:/path/to/myjar.jar!/foo.txt");
JarURLConnection connection = (JarURLConnection) jarURL.openConnection();
try {
long lastModified = connection.getLastModified();
} finally {
connection.getInputStream().close();
}
Thread.sleep(300000);{code}
Now check the file descriptors in /proc/<java PID>/fd to see that there is still one
open for the JAR.
Not that {{ClassPathResource.getLastModified()}} makes any attempt to close this file
descriptor in the first place.
was:
URL jarURL = new URL("jar:file:/path/to/myjar.jar!/foo.txt");
JarURLConnection connection = (JarURLConnection) jarURL.openConnection();
try {
long lastModified = connection.getLastModified();
} finally {
connection.getInputStream().close();
}
Thread.sleep(300000);
Now check the file descriptors in /proc/<java PID>/fd to see that there is still one
open for the JAR.
Not that {{ClassPathResource.getLastModified()}} makes any attempt to close this file
descriptor in the first place.
ClassPathResource.getLastModified() leaks a file descriptor
-----------------------------------------------------------
Key: JBRULES-3651
URL:
https://issues.jboss.org/browse/JBRULES-3651
Project: Drools
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: drools-core
Affects Versions: 5.4.0.Final, 5.5.0.Beta1
Environment: Fedora 17, JDK6
Reporter: Chris Rankin
Assignee: Mark Proctor
Calling {{getLastModified()}} on a {{ClassPathResource}} allocates a file descriptor and
doesn't release it until the {{ClassPathResource}} object is garbage-collected.
I believe that this is a bug in {{JarURLConnection}} in Sun's JDK6, as noticed by the
Freemarker project, who also created a
[
fix|http://sourceforge.net/tracker/index.php?func=detail&aid=1824122&...].
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira