Mark,

On 2/1/2021 1:33 AM, Mark Thomas wrote:
Is the GC root above the only one? I've seen similar behaviour in the
past where weak references appear to be the cause of a leak but closer
inspection uncovers a strong reference.

Mark

Thanks for putting me on the correct track. I'm using log4j2 2.14.0 and Jersey REST 2.33 which includes Jackson 2.11.3.

Analyzing the heap dump using Eclipse MAT and excluding weak references led me down a fun rabbit hole.

Leak 1:
https://github.com/FasterXML/jackson-core/issues/400

Fix:
in setenv.(bat/sh) add
-Dcom.fasterxml.jackson.core.util.BufferRecyclers.trackReusableBuffers=true

In a servlet context listener add
int released = releaseBuffers(); // with the proper import, of course

Leak 2:
https://issues.apache.org/jira/browse/LOG4J2-578

Although it's marked as fixed, it apparently is not.

Fix (for now):
in setenv(bat/sh) add
-Dlog4j2.disable.jmx=true

With all of that done, undeploying the web application and doing a heap dump shows no traces of the offending app (all WebappClassLoaders have started=true).

Again, thanks for the tip.

. . . just my two cents.

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to