Project Jigsaw, Apache Tomcat and RMI related memory leaks

Mark Thomas markt at apache.org
Mon Apr 18 11:26:23 UTC 2016


On 18/04/2016 12:14, Alan Bateman wrote:
> On 18/04/2016 10:18, Mark Thomas wrote:
>> Hi,
>>
>> The Apache Tomcat community was asked by Rory O'Donnell for feedback on
>> JDK 9 + Project Jigsaw. Having provided that feedback we were directed
>> here so I have reproduced that feedback below.
>>
>>
>> I've started testing Tomcat trunk with JDK 9 + Project Jigsaw and it
>> looks like we are going to hit a bunch of problems related to Tomcat's
>> memory leak protection.
>>
>> The short version is there are lots of JDK calls that can result in a
>> reference being retained to the current class loader. If that class
>> loader is the web application class loader it often ends up being pinned
>> in memory. This triggers a memory leak when the web application is
>> reloaded since the web application class loader is not eligible for GC.
>>
>> Tomcat generally uses reflection to find these problems. It then does
>> one of two things:
>> - If the JRE provides an API the application developer should have used
>> to clean up the reference, Tomcat does this for them and then logs a
>> very loud error message telling the developer they need to fix their app.
>> - If there is nothing the developer could have done to avoid the
>> problem, Tomcat cleans it up. Usually this is via reflection again.
>>
>> Reporting this second class of issues as JRE bugs has been on my TODO
>> list for a long time. It looks like Java 9 is going to bump this to the
>> top of the list.
> I remember you brought this up on core-libs-dev [1] and the suggestion
> at the time was to create bugs for any of the issues that are still
> relevant. So yes, bumping the priority on that would be good.
> 
> On the RMI issue then it would be good to start a thread specifically on
> this topic on core-libs-dev.

OK. I'll restart this thread there. I'm also reviewing the various other
leaks and I'll start new threads as each one is confirmed.

Mark


More information about the jigsaw-dev mailing list