mengdiwang / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

Tomcat 7 reports memory leaks in Guava-powered webapps #517

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Tomcat 7 (7.0.4, 7.0.5) has memory leak detector.
When I undeploy my app or shutdown tomcat it emits warnings:

08.01.2011 13:38:48 org.apache.catalina.loader.WebappClassLoader 
clearReferencesThreads
SEVERE: The web application [/myappname] appears to have started a thread named 
[com.google.common.base.internal.Finalizer] but has failed to stop it. This is 
very likely to create a memory leak.

08.01.2011 13:38:48 org.apache.catalina.loader.WebappClassLoader 
clearReferencesThreads
SEVERE: The web application [/myappname] appears to have started a thread named 
[com.google.common.base.internal.Finalizer] but has failed to stop it. This is 
very likely to create a memory leak.

When I looked in source i found 
com.google.common.base.internal.Finalizer

it is daemon thread and it ignore all "stop the thread" notifications:

  /**
   * Loops continuously, pulling references off the queue and cleaning them up.
   */
  @SuppressWarnings("InfiniteLoopStatement")
  @Override
  public void run() {
    try {
      while (true) {
        try {
          cleanUp(queue.remove());
        } catch (InterruptedException e) { /* ignore */ }
      }
    } catch (ShutDown shutDown) { /* ignore */ }
  }

As I know daemon threads prevent webapp from undeploing correctly in Tomcat.

Original issue reported on code.google.com by aprpda on 8 Jan 2011 at 11:02

GoogleCodeExporter commented 9 years ago
I found same issue 
http://code.google.com/p/guava-libraries/issues/detail?id=92

Original comment by rybin.andrey on 8 Jan 2011 at 4:32

GoogleCodeExporter commented 9 years ago

Original comment by kevinb@google.com on 12 Jan 2011 at 8:36

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:15

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:09