I've been working on a service thats built on Scala + Play (2.5.3), which also makes some use of Akka actors (with no remote-ing). Recently i've noticed that the service intermittently goes down due to OOM. Looked up the .hprof dump files (set to be created on OOM failures) and it appears that 9000+ (!) worker threads (akka.dispatch.MonitorableThreadFactory$AkkaForkJoinWorkerThread) were created named 'application-akka.actor.default-dispatcher-xxxx'. Additionally, all these worker threads have no stack trace or a history of any task assigned to them.
Refer attached .csv of Eclipse Memory Analyzer's thread summary.
Note :
1) I haven't defined any custom Dispatcher / Execution Context / Thread Pool.
2) As per Play's docs, i've ensured that ActorSystems are only injected and never created, hence only play's default actor system is used.
I assumed that a max of 64 threads would be created since only the default actor system was used, but these many threads is very strange.
Any help with analysing this issue would be great, more specifically any advice on how to ascertain how/why these 'ghost' workers threads are created would be super useful. Any tools to monitor creation of worker threads by Akka Dispatcher?
-- Abhilash