Here is what we've figured out. We've got a native library that contains a 
thread local member that includes a ZMQ socket. That socket is apparently 
not being correctly cleaned-up on thread death. ZMQ sockets are created 
from a ZMQ context, which creates 2 helper threads upon construction. Those 
are the threads we were leaking. 

The actor in Akka was invoking this native library. In our old code, using 
Scala's now-deprecated, built-in actor library, we had locked that actor to 
a single thread, so there was never any thread leakage. In Akka, we were 
using a Pinned dispatcher, with the understanding that that would result in 
the same behavior. The scalaDocs say "Dedicates a unique thread for each 
actor passed in as reference."  

The akka manual also adds "Note that it's not guaranteed that the *same* 
thread is used over time, since the core pool timeout is used for 
PinnedDispatcher to keep resource usage down in case of idle actors. To use 
the same thread all the time you need to add 
thread-pool-executor.allow-core-timeout=off to the configuration of the 
PinnedDispatcher."

We missed that part. It might help others to have that added to the 
scaladocs.

The solution that we've found to work is to set the allow-core-timeout to 
off and the thread-pool-executor.keep-alive-time to a really high number. 
With those settings we've now got the behavior we thought we were 
originally getting, where the actor is locked into a single thread for its 
entire lifetime.

We're also looking at fixing the thread leak issue in the native library.

Thanks for the responses.

cheers
jesse c


-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to