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 ) { } } } }Title: BugRat Report # 575
BugRat Report # 575
Project: Tomcat | Release: Tomcat 3.2 Final |
Category: Bug Report | SubCategory: New Bug Report |
Class: swbug | State: received |
Priority: high | Severity: critical |
Confidence:
public
|
Submitter:
Joel Bartley ( [EMAIL PROTECTED] )
Date Submitted:
Dec 12 2000, 01:18:45 CST
Responsible:
Z_Tomcat Alias ( [EMAIL PROTECTED] )
- Synopsis:
- AdaptiveClassLoader leaks file descriptors
- Environment: (jvm, os, osrel, platform)
- 1.1.8, AIX, 4.3.3, PowerPC
- Additional Environment Description:
- Report 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 ) { } } } }