Bug 52729

Summary: An incomplete fix for the resource leak bug in CometConnectionManagerValve.java
Product: Tomcat 7 Reporter: lianggt08
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Severity: enhancement    
Priority: P2    
Version: trunk   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description lianggt08 2012-02-21 12:01:25 UTC
The fix revision 640273 was aimed to remove an resource leak bug on the  CometEventImpl object "cometEvent " (created line 130) in the method "lifecycleEvent()" of the file "/tomcat/trunk/java/org/apache/catalina/valves/CometConnectionManagerValve.java" , but it is incomplete. 

There are some problems: 
1. when the statements at lines 131-134 throw some exception, the "cometEvent" 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.
Comment 1 Mark Thomas 2012-03-06 21:27:10 UTC
r640273 has nothing to do with fixing potential resource leaks.

If the end event fails, the chances of the close event working are pretty slim.

Given that this code is part of the shutdown, a resource leak at this point is a minor issue at best and is probably not an issue at all.

Yet another enhancement where the severity has been badly mis-judged.