Memory leak in a Clojure web application

I created a web application in Clojure, packaged it as a WAR, and deployed it on top of Tomcat. It works as I expect, but when I go to close Tomcat, I see many exceptions, such as:

SEVERE: The web application [] created a ThreadLocal with key of type 
[java.lang.ThreadLocal] (value [java.lang.ThreadLocal@fc5408]) and a value of type [clojure.lang.LockingTransaction] (value [clojure.lang.LockingTransaction@12db7c]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
Mar 17, 2011 4:19:48 AM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [] created a ThreadLocal with key of type [null] (value [clojure.lang.Var$1@11de914]) and a value of type [clojure.lang.Var.Frame] (value [clojure.lang.Var$Frame@7c28c]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
Mar 17, 2011 4:19:48 AM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [] created a ThreadLocal with key of type [null] (value [clojure.lang.Var$1@11de914]) and a value of type [clojure.lang.Var.Frame] (value [clojure.lang.Var$Frame@17588d5]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.

I understand that there are some clojure things that can sometimes get a little ahead of the Java garbage collector. My war has a ServletContextListener that launches several background threads, but I see no reason why they cannot just be gracefully terminated (they are not daemon threads, after all) when the context is unpacked.

Perhaps the best / other way I should use to start my threads, which are more suitable for Tomcat? Right now I'm just starting them by calling (future (loop ....

+3
1

-, Tomcat - .

, , , Tomcat , /threadlocal /.

, , - , JVM .

(future (loop...)) , , . ""? , . , .

+1

All Articles