Tomcat complaints when redeploying servlet with akka inside
Then redeploying servlet without tomcat restart I got the following diagnostic message:
I'm perform shutdown for akka system and waiting for termination in destroy() method of my servlet:
SEVERE: The web application [] created a ThreadLocal with key of type [scala.concurrent.forkjoin.ForkJoinPool.ThreadSubmitter] (value [scala.concurrent.forkjoin.ForkJoinPool$ThreadSubmitter@603fe663]) and a value of type [scala.concurrent.forkjoin.ForkJoinPool.Submitter] (value [scala.concurrent.forkjoin.ForkJoinPool$Submitter@32e9ef3]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
I'm perform shutdown for akka system and waiting for termination in destroy() method of my servlet:
@Override
public void destroy() {
final SpringContextHelper springContextHelper = new SpringContextHelper(getServletContext());
final ActorSystem system = springContextHelper.getBean("localActorSystem", ActorSystem.class);
system.shutdown();
system.awaitTermination();
super.destroy();
}
Leave a comment
on 2012-11-01 02:17 *
By worufuramo
Description changed from Then redeploying servlet wi... to Then redeploying servlet wi...
It's just Tomcat being overzealous, the threads in question will terminate on their own after 4 seconds of silence.
There's already a ticket for potentially making awaitTermination wait for that, but it's not critical since it's really not a bug.
https://www.assembla.com/spaces/akka/tickets/2479#/activity/ticket:
There's already a ticket for potentially making awaitTermination wait for that, but it's not critical since it's really not a bug.
https://www.assembla.com/spaces/akka/tickets/2479#/activity/ticket:
on 2012-11-02 05:10 *
By worufuramo
It's some kind of bug anyway. After some redeploys tomcat may crash with OOM exception. Without akkasystem it works fine, so I assume that memory leak is not in my code.