0

I'm having an issue when attempting to when gracefully shutting down tomcat. This severe warning is issued and the application will hang until terminated. Seems to be related to codahale in this case unlike another few similar questions. Any suggestions on a fix. Thanks in advance.

(Using Tomcat 7.0.78 through Intellij)

created a ThreadLocal with key of type 
[com.codahale.metrics.ThreadLocalRandom$1] (value 
[com.codahale.metrics.ThreadLocalRandom$1@7008afaf]) and a value of 
type [com.codahale.metrics.ThreadLocalRandom] (value 
[com.codahale.metrics.ThreadLocalRandom@cb6fe27]) but failed to remove 
it when the web application was stopped. Threads are going to be 
renewed over time to try and avoid a probable memory leak.
Ollie
  • 63
  • 1
  • 5
  • Possible duplicate of [Is this very likely to create a memory leak in Tomcat?](https://stackoverflow.com/questions/5292349/is-this-very-likely-to-create-a-memory-leak-in-tomcat) – Olaf Kock Aug 04 '17 at 12:22

1 Answers1

0

This is an open issue: https://github.com/dropwizard/metrics/issues/742

com.codahale.metrics.ThreadLocalRandom is a class loaded by the same classloader that loads Codahale so that class has a reference to it's classloader which prevents all other classes to be garbage collected. If codahale is part of your application then all your classes will not be garbage collected. Try to put codahale in common/lib instead of your app and see what happens. I think that that would allow your application to be gc-ed.

CodesInTheDark
  • 151
  • 1
  • 9