Skip to content

Loading…

Tomcat complains about Lift Scheduler thread on context stop/reload #1001

Closed
indrajitr opened this Issue · 2 comments

3 participants

@indrajitr
Lift Web Framework member

Scala 2.8.1, Lift 2.3, Tomcat 6.0.32 (haven't tried Tomcat 7.x.x)

Catalina.log:


12:20:44.623 [http-8080-3] DEBUG net.liftweb.http.LiftServlet - Destroyed Lift handler. 
May 4, 2011 12:20:44 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 
SEVERE: The web application [/token-service] appears to have started a thread named [Lift Scheduler] but has failed to stop it. This is very likely to create a memory leak. 

According to http://wiki.apache.org/tomcat/MemoryLeakProtection#cclThreadSpawnedByWebApp adding:

thread.setContextClassLoader(null)
would take care of the issue.

In case of Lift that would mean modifying net/liftweb/util/ Schedule.scala:


private object TF extends ThreadFactory { 
  val threadFactory = Executors.defaultThreadFactory() 
  def newThread(r: Runnable) : Thread = { 
    val d: Thread = threadFactory.newThread(r) 
    d setName "Lift Scheduler" 
    d setDaemon true 
+   d setContextClassLoader null 
    d 
  } 
} 

No idea what impact this change would have in Jetty and other containers.
Any plans on adding this workaround or rather waiting it out (hoping that Tomcat guys can sort it out)?

See also: http://groups.google.com/group/liftweb/browse_frm/thread/44f4b42115d666d8

@indrajitr
Lift Web Framework member

Thanks for implementing the workaround David.

@dpp dpp was assigned
@etorreborre etorreborre pushed a commit to etorreborre/framework that referenced this issue
@dpp dpp Cloese #1001. Do something nice for Tomcat f7da1d3
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.