You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by BugRat Mail System <to...@cortexity.com> on 2000/12/12 20:18:45 UTC
BugRat Report #575 has been filed.
Bug report #575 has just been filed.
You can view the report at the following URL:
<http://znutar.cortexity.com/BugRatViewer/ShowReport/575>
REPORT #575 Details.
Project: Tomcat
Category: Bug Report
SubCategory: New Bug Report
Class: swbug
State: received
Priority: high
Severity: critical
Confidence: public
Environment:
Release: Tomcat 3.2 Final
JVM Release: 1.1.8
Operating System: AIX
OS Release: 4.3.3
Platform: PowerPC
Synopsis:
AdaptiveClassLoader leaks file descriptors
Description:
Under JDK 1.1.8, the AdaptiveClassLoader leaks file
descriptors from the getResource method. This gets invoked
( among other times ) every time Beans.instantiate is called
with the servlet classloader instead of null ( it tries to
find a serialized bean before creating a default instance ).
The ZipFile object used to look in jars found in the
repository list is never explicitly closed ( and the finalize
method doesn't seem to do it either ). The solution is
to close the ZipFile in a finally block. Each time this
method runs and searches a zip file ( or jar ), it will leak
one file descriptor for each file it processes ( we have 10
jars in our WEB-INF/lib so that's 10 file descriptors for
each hit to a page with one jsp:useBean ). A patch follows:
--- jakarta-tomcat-3.2.orig/src/org/apache/tomcat/loader/AdaptiveClassLoader.java Wed Nov 29 20:47:52 2000
+++ jakarta-tomcat-3.2/src/org/apache/tomcat/loader/AdaptiveClassLoader.java Tue Dec 12 13:47:05 2000
@@ -804,8 +804,9 @@
// a jar:-URL *could* change even between minor releases, but
// didn't between JVM's 1.1.6 and 1.3beta. Tested on JVM's from
// IBM, Blackdown, Microsoft, Sun @ Windows and Sun @ Solaris
+ ZipFile zf = null;
try {
- ZipFile zf = new ZipFile(file.getAbsolutePath());
+ zf = new ZipFile(file.getAbsolutePath());
ZipEntry ze = zf.getEntry(name);
if (ze != null) {
@@ -819,6 +820,8 @@
} catch (IOException ioe) {
ioe.printStackTrace();
return null;
+ } finally {
+ if ( zf != null ) try { zf.close(); } catch ( IOException e ) { }
}
}
}