tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject DO NOT REPLY [Bug 52721] New: An incomplete fix for the resource leak bug in
Date Tue, 21 Feb 2012 10:00:19 GMT

             Bug #: 52721
           Summary: An incomplete fix for the resource leak bug in
           Product: Tomcat 6
           Version: unspecified
          Platform: PC
            Status: NEW
          Severity: critical
          Priority: P2
         Component: Catalina
    Classification: Unclassified

The fix revision 423920 was aimed to remove an resource leak bug on the 
FileOutputStream object "fos"and the ObjectOutputStream "oos"  in the method
"cacheContext" of the file
"/tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/" ,
but it is incomplete. 

When the statements at lines 4792 throw any eception, the objects "fos" and
"oos" can not be closed as expected. The best way to close such resource object
is putting such close operations in the finaly block of a try-catch-finally

Besides that, when oos is created unsuccessfully but "fos"  is created
successfully,  "fos" will also be leaked. 

The buggy code in the head revision is copied as bellows:

 private void cacheContext() {
        try {
            File workDir=new File( getWorkPath() );

            File ctxSer=new File( workDir, "_tomcat_context.ser");
            FileOutputStream fos=new FileOutputStream( ctxSer );
            ObjectOutputStream oos=new ObjectOutputStream( fos );
[line 4793]            oos.close();
[line 4794]            fos.close();
        } catch( Throwable t ) {
      "Error saving context.ser ", t);

Configure bugmail:
------- You are receiving this mail because: -------
You are the assignee for the bug.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message