Tomcat complains about Lift Scheduler thread on context stop/reload

214 views
Skip to first unread message

Paul Roman

unread,
May 4, 2011, 1:03:51 PM5/4/11
to Lift
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 to:

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)?

Thanks,
-r-

David Pollak

unread,
May 4, 2011, 1:34:30 PM5/4/11
to lif...@googlegroups.com
Please open a ticket at http://ticket.liftweb.net (you must be a watcher of the LiftWeb space on Assembla to open tickets)


--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.




--
Lift, the simply functional web framework http://liftweb.net

Paul Roman

unread,
May 4, 2011, 1:55:04 PM5/4/11
to Lift
Thanks for the reply.

Ticket filed:
https://www.assembla.com/spaces/liftweb/tickets/1001-tomcat-complains-about-lift-scheduler-thread-on-context-stop-reload

On May 4, 1:34 pm, David Pollak <feeder.of.the.be...@gmail.com> wrote:
> Please open a ticket athttp://ticket.liftweb.net(you must be a watcher of
> the LiftWeb space on Assembla to open tickets)
>
>
>
>
>
>
>
>
>
> On Wed, May 4, 2011 at 10:03 AM, Paul Roman <i.zu...@gmail.com> wrote:
> > 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#cclThreadSpawnedBy...
> Beginning Scalahttp://www.apress.com/book/view/1430219890

David Pollak

unread,
May 4, 2011, 2:25:27 PM5/4/11
to lif...@googlegroups.com

On May 4, 2011, at 10:55 AM, Paul Roman <i.z...@gmail.com> wrote:

Excellent

Reply all
Reply to author
Forward
0 new messages