You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2012/02/21 11:35:32 UTC

DO NOT REPLY [Bug 52724] New: An incomplete fix for the resource leak bugs in Catalina.java

https://issues.apache.org/bugzilla/show_bug.cgi?id=52724

             Bug #: 52724
           Summary: An incomplete fix for the resource leak bugs in
                    Catalina.java
           Product: Tomcat 7
           Version: trunk
          Platform: PC
            Status: NEW
          Severity: critical
          Priority: P2
         Component: Catalina
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: lianggt08@sei.pku.edu.cn
    Classification: Unclassified


The fix revision 730178 was aimed to remove an resource leak bug on the 
FileInputStream object "fis" (created line 458), the Socket "socket" (created
at line 477), 

the OutputStream object "stream", and the FileInputStream object "inputStream"
in the file
"/tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/Catalina.java" , but 

it is incomplete. 

There are some problems: 
1. the InputSource object "is" created at line 452 is not closed. 
2. when the statements at lines 455-457 throw some exception, the "fis" can not
be closed as expected. 
3. when the statements at lines 480-483 throw some exception, the "socket" and
the "stream" can not be closed as expected. 
4. when the statements at lines 574-576 throw some exception, the "inputStream"
can not be closed as expected. 

The best way to close such resource objects is putting such close operations in
the finaly block of a try-catch-finally structure.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 52724] An incomplete fix for the resource leak bugs in Catalina.java

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52724

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
         OS/Version|                            |All
           Severity|critical                    |enhancement

--- Comment #1 from Mark Thomas <ma...@apache.org> 2012-03-05 20:12:51 UTC ---
(In reply to comment #0)
For all of the cases raised (at least those that are valid) the JVM is about 10
lines away from shutting down which makes any possible resource leak pretty
much irrelevant. This demonstrates the necessity of understanding the code
before claiming that a critical bug exists.

I was tempted to resolve this bug as INVALID but it is true that the code could
be cleaner and that would prevent someone creating a duplicate (and similarly
pointless) issue in the future.

I have therefore changed this bug to an enhancement and cleaned up the code.

Responding to the specific points:

> 1. the InputSource object "is" created at line 452 is not closed. 

It is an InputSource not an InputStream. There is no close() method.

> 2. when the statements at lines 455-457 throw some exception, the "fis" can not
> be closed as expected.

And less than a second later the JVM shuts down. Not an issue. Cleaned up
anyway.

> 3. when the statements at lines 480-483 throw some exception, the "socket" and
> the "stream" can not be closed as expected.

Non-issue for the same reason as 2.

> 4. when the statements at lines 574-576 throw some exception, the "inputStream"
> can not be closed as expected.

Non-issue for the same reason as 2.

Before raising a bug, especially a critical one, it is important to do
sufficient research to be very sure of your ground. If someone can't be
bothered to do the research to ensure a bug is valid, don't expect the Tomcat
committers to bother to explain why they have closed a bug as INVALID.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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