Bug 50780

Summary: AjpConnectionHandler keeps many connections causing memory leak
Product: Tomcat 7 Reporter: Sergiusz <Sergiusz.Brzezinski>
Component: ConnectorsAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 7.0.6   
Target Milestone: ---   
Hardware: PC   
OS: Linux   

Description Sergiusz 2011-02-15 04:51:49 UTC
Hi,

Sorry for my english.

I use Tomcat 7.0.6 with APR 1.1.20. 

I noticed (from heap dump) many org.apache.tomcat.util.net.SocketWrapper objects, which are kept by "connections" atribute in org.apache.coyote.ajp.AjpAprProtocol$AjpConnectionHandler object. I don't understand, why there are so many objects representing old connections which are not active. In my example it was 300000 objects created, after 7 days of Tomcat work. Has someone forgotten to clean this HashMap from time to time?

best regards

Sergiusz Brzezinski
Comment 1 Mark Thomas 2011-02-15 12:17:05 UTC
This is Tomcat 7 specific Java code, not part of the APR native code.
Comment 2 Mark Thomas 2011-02-15 12:39:27 UTC
There was some clean-up in this area for 7.0.8. It is worth testing with the latest version to see if this has already been fixed.
Comment 3 Mark Thomas 2011-02-17 09:18:17 UTC
Yes it does still happen with 7.0.8 and is specific to the APR implementation of the AJP connector. Testing a fix now...
Comment 4 Mark Thomas 2011-02-17 11:08:23 UTC
This has been fixed in trunk and will be included in 7.0.9 onwards.