Issue #2534: WeakRef Purge ObjectDb threads not stopping with Tomcat (in application container)

Type: Bug ReoprtVersion: 2.7.6Priority: NormalStatus: FixedReplies: 1


We have threads that are not stopping with Tomcat requiring a hard stop of the container.  Can you please help us resolve this issue?


Clinton / Fazle

What is the impact of the issue ?
• When we perform web application reloads on our servers we observe memory leaks.  As the memory allocated to the previous web application instance is not garbage collected due to these threads being alive.
• We are also suspecting the server taking a long time to stop, because of this issue.

Warning message from our tomcat server log –
               11-Feb-2020 08:46:54.741 WARNING [http-nio-8080-exec-9] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads
               The web application [CAPReportServer##000.00] appears to have started a thread named [ODB- WeakRefPurger] but has failed to stop it. This is very likely to create a memory leak.

Stack trace of the non-terminating objectdb thread –

"ODB-WeakRefPurger" - Thread t@35
   java.lang.Thread.State: WAITING
        at java.lang.Object.wait(Native Method)
        - waiting on <68c32d6f> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(
        at java.lang.ref.ReferenceQueue.remove(
        at com.objectdb.o.RTM$


This is a daemon thread that runs until the JVM exits. Please try ObjectDB version 2.8.2, in which the global thread is replaced with a an EntityManagerFactory scope thread. The new thread exists when the EntityManagerFactory is closed, so it should be more friendly for Tomcat and similar containers.

ObjectDB Support