Re: [akka-user] Akka threads prevents jvm from existing

2015-02-20 Thread Patrik Nordwall
If an actor is blocking (processing a message) the shutdown will not
complete until that is finished.
/Patrik

On Fri, Feb 20, 2015 at 10:30 AM, Akka Team  wrote:

> Hi there and welcome to akka-user!
> In general it shouldn't take that long for an actor system to shut down,
> would you mind sharing an outline of the code you're using to shutdown the
> system?
> Are you sure shutdown was actually called? Shutting down is progagated as
> system message, which has higher priority than user-land messages, so it
> shouldn't get held up by high user-land traffic..
> Also, here's a nice slightly more useful way to get stacktraces of a
> running app:
>
> jps # find the java process id
> jstack JPID
>
> which will give you a full stacktrace of all threads, that's usually the
> preferred way to share stacktraces.
>
>  -- Konrad
>
> On Mon, Feb 16, 2015 at 8:02 AM, George Lu  wrote:
>
>> Dear all,
>>
>> I searched on Google but cannot find any similar topics. I am a Akka
>> newbie and used Akka to start some workers to process time consuming tasks.
>> I used system.AwaitTermination() and system.shutdown() to shutdown Akka.
>> My Akka used RoundRobinRouter and schedules 10 workers.
>> But, the JVM does not exit. Then I print all running threads.
>>
>> Map threads =  Thread.getAllStackTraces();
>> for(Thread t:threads.keySet()){
>>
>> System.out.println("");
>> System.out.println(t.getId()+":"+t.getName()+" is
>> daemon:"+t.isDaemon());
>> for(StackTraceElement stackTrace: threads.get(t)){
>>
>> System.out.println(stackTrace.getFileName());
>> System.out.println(stackTrace.getClassName());
>> System.out.println(stackTrace.getMethodName());
>> System.out.println(stackTrace.isNativeMethod());
>> }
>>
>> System.out.println("");
>> }
>>
>> The following is the output.
>> Can anyone give me any hint whether is Akka prevent the JVM from exiting
>> and if it is, how to prevent that?
>>
>> Thanks!
>> George
>>
>> 
>> 2:Reference Handler is daemon:true
>> Object.java
>> java.lang.Object
>> wait
>> true
>> Object.java
>> java.lang.Object
>> wait
>> false
>> Reference.java
>> java.lang.ref.Reference$ReferenceHandler
>> run
>> false
>> 
>> 
>> 27:CreationSystem-akka.actor.default-dispatcher-6 is daemon:false
>> Unsafe.java
>> sun.misc.Unsafe
>> park
>> true
>> ForkJoinPool.java
>> scala.concurrent.forkjoin.ForkJoinPool
>> idleAwaitWork
>> false
>> ForkJoinPool.java
>> scala.concurrent.forkjoin.ForkJoinPool
>> scan
>> false
>> ForkJoinPool.java
>> scala.concurrent.forkjoin.ForkJoinPool
>> runWorker
>> false
>> ForkJoinWorkerThread.java
>> scala.concurrent.forkjoin.ForkJoinWorkerThread
>> run
>> false
>> 
>> 
>> 20:pool-3-thread-1 is daemon:false
>> Unsafe.java
>> sun.misc.Unsafe
>> park
>> true
>> LockSupport.java
>> java.util.concurrent.locks.LockSupport
>> park
>> false
>> AbstractQueuedSynchronizer.java
>> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject
>> await
>> false
>> ScheduledThreadPoolExecutor.java
>> java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue
>> take
>> false
>> ScheduledThreadPoolExecutor.java
>> java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue
>> take
>> false
>> ThreadPoolExecutor.java
>> java.util.concurrent.ThreadPoolExecutor
>> getTask
>> false
>> ThreadPoolExecutor.java
>> java.util.concurrent.ThreadPoolExecutor
>> runWorker
>> false
>> ThreadPoolExecutor.java
>> java.util.concurrent.ThreadPoolExecutor$Worker
>> run
>> false
>> Thread.java
>> java.lang.Thread
>> run
>> false
>> 
>> 
>> 18:CreationSystem-akka.actor.default-dispatcher-4 is daemon:false
>> Unsafe.java
>> sun.misc.Unsafe
>> park
>> true
>> ForkJoinPool.java
>> scala.concurrent.forkjoin.ForkJoinPool
>> scan
>> false
>> ForkJoinPool.java
>> scala.concurrent.forkjoin.ForkJoinPool
>> runWorker
>> false
>> ForkJoinWorkerThread.java
>> scala.concurrent.forkjoin.ForkJoinWorkerThread
>> run
>> false
>> 
>> 
>> 12:C3P0PooledConnectionPoolManager[identityToken->1hge24797149gw291ezhx58|6badc6a5]-HelperThread-#0
>> is daemon:true
>> Object.java
>> java.lang.Object
>> wait
>> true
>> ThreadPoolAsynchronousRunner.java
>> com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread
>> run
>> false
>> 
>> 
>> 22:pool-3-

Re: [akka-user] Akka threads prevents jvm from existing

2015-02-20 Thread Akka Team
Hi there and welcome to akka-user!
In general it shouldn't take that long for an actor system to shut down,
would you mind sharing an outline of the code you're using to shutdown the
system?
Are you sure shutdown was actually called? Shutting down is progagated as
system message, which has higher priority than user-land messages, so it
shouldn't get held up by high user-land traffic..
Also, here's a nice slightly more useful way to get stacktraces of a
running app:

jps # find the java process id
jstack JPID

which will give you a full stacktrace of all threads, that's usually the
preferred way to share stacktraces.

 -- Konrad

On Mon, Feb 16, 2015 at 8:02 AM, George Lu  wrote:

> Dear all,
>
> I searched on Google but cannot find any similar topics. I am a Akka
> newbie and used Akka to start some workers to process time consuming tasks.
> I used system.AwaitTermination() and system.shutdown() to shutdown Akka.
> My Akka used RoundRobinRouter and schedules 10 workers.
> But, the JVM does not exit. Then I print all running threads.
>
> Map threads =  Thread.getAllStackTraces();
> for(Thread t:threads.keySet()){
>
> System.out.println("");
> System.out.println(t.getId()+":"+t.getName()+" is
> daemon:"+t.isDaemon());
> for(StackTraceElement stackTrace: threads.get(t)){
>
> System.out.println(stackTrace.getFileName());
> System.out.println(stackTrace.getClassName());
> System.out.println(stackTrace.getMethodName());
> System.out.println(stackTrace.isNativeMethod());
> }
>
> System.out.println("");
> }
>
> The following is the output.
> Can anyone give me any hint whether is Akka prevent the JVM from exiting
> and if it is, how to prevent that?
>
> Thanks!
> George
>
> 
> 2:Reference Handler is daemon:true
> Object.java
> java.lang.Object
> wait
> true
> Object.java
> java.lang.Object
> wait
> false
> Reference.java
> java.lang.ref.Reference$ReferenceHandler
> run
> false
> 
> 
> 27:CreationSystem-akka.actor.default-dispatcher-6 is daemon:false
> Unsafe.java
> sun.misc.Unsafe
> park
> true
> ForkJoinPool.java
> scala.concurrent.forkjoin.ForkJoinPool
> idleAwaitWork
> false
> ForkJoinPool.java
> scala.concurrent.forkjoin.ForkJoinPool
> scan
> false
> ForkJoinPool.java
> scala.concurrent.forkjoin.ForkJoinPool
> runWorker
> false
> ForkJoinWorkerThread.java
> scala.concurrent.forkjoin.ForkJoinWorkerThread
> run
> false
> 
> 
> 20:pool-3-thread-1 is daemon:false
> Unsafe.java
> sun.misc.Unsafe
> park
> true
> LockSupport.java
> java.util.concurrent.locks.LockSupport
> park
> false
> AbstractQueuedSynchronizer.java
> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject
> await
> false
> ScheduledThreadPoolExecutor.java
> java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue
> take
> false
> ScheduledThreadPoolExecutor.java
> java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue
> take
> false
> ThreadPoolExecutor.java
> java.util.concurrent.ThreadPoolExecutor
> getTask
> false
> ThreadPoolExecutor.java
> java.util.concurrent.ThreadPoolExecutor
> runWorker
> false
> ThreadPoolExecutor.java
> java.util.concurrent.ThreadPoolExecutor$Worker
> run
> false
> Thread.java
> java.lang.Thread
> run
> false
> 
> 
> 18:CreationSystem-akka.actor.default-dispatcher-4 is daemon:false
> Unsafe.java
> sun.misc.Unsafe
> park
> true
> ForkJoinPool.java
> scala.concurrent.forkjoin.ForkJoinPool
> scan
> false
> ForkJoinPool.java
> scala.concurrent.forkjoin.ForkJoinPool
> runWorker
> false
> ForkJoinWorkerThread.java
> scala.concurrent.forkjoin.ForkJoinWorkerThread
> run
> false
> 
> 
> 12:C3P0PooledConnectionPoolManager[identityToken->1hge24797149gw291ezhx58|6badc6a5]-HelperThread-#0
> is daemon:true
> Object.java
> java.lang.Object
> wait
> true
> ThreadPoolAsynchronousRunner.java
> com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread
> run
> false
> 
> 
> 22:pool-3-thread-3 is daemon:false
> Unsafe.java
> sun.misc.Unsafe
> park
> true
> LockSupport.java
> java.util.concurrent.locks.LockSupport
> park
> false
> AbstractQueuedSynchronizer.java
> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject
> await
> false
> ScheduledThreadPoolExecutor.java
> java.util.concurrent.ScheduledThread

[akka-user] Akka threads prevents jvm from existing

2015-02-15 Thread George Lu
Dear all,

I searched on Google but cannot find any similar topics. I am a Akka newbie 
and used Akka to start some workers to process time consuming tasks.
I used system.AwaitTermination() and system.shutdown() to shutdown Akka.
My Akka used RoundRobinRouter and schedules 10 workers.
But, the JVM does not exit. Then I print all running threads.

Map threads =  Thread.getAllStackTraces();
for(Thread t:threads.keySet()){

System.out.println("");
System.out.println(t.getId()+":"+t.getName()+" is 
daemon:"+t.isDaemon());
for(StackTraceElement stackTrace: threads.get(t)){

System.out.println(stackTrace.getFileName());
System.out.println(stackTrace.getClassName());
System.out.println(stackTrace.getMethodName());
System.out.println(stackTrace.isNativeMethod());
}

System.out.println("");
}

The following is the output.
Can anyone give me any hint whether is Akka prevent the JVM from exiting 
and if it is, how to prevent that?

Thanks!
George


2:Reference Handler is daemon:true
Object.java
java.lang.Object
wait
true
Object.java
java.lang.Object
wait
false
Reference.java
java.lang.ref.Reference$ReferenceHandler
run
false


27:CreationSystem-akka.actor.default-dispatcher-6 is daemon:false
Unsafe.java
sun.misc.Unsafe
park
true
ForkJoinPool.java
scala.concurrent.forkjoin.ForkJoinPool
idleAwaitWork
false
ForkJoinPool.java
scala.concurrent.forkjoin.ForkJoinPool
scan
false
ForkJoinPool.java
scala.concurrent.forkjoin.ForkJoinPool
runWorker
false
ForkJoinWorkerThread.java
scala.concurrent.forkjoin.ForkJoinWorkerThread
run
false


20:pool-3-thread-1 is daemon:false
Unsafe.java
sun.misc.Unsafe
park
true
LockSupport.java
java.util.concurrent.locks.LockSupport
park
false
AbstractQueuedSynchronizer.java
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject
await
false
ScheduledThreadPoolExecutor.java
java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue
take
false
ScheduledThreadPoolExecutor.java
java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue
take
false
ThreadPoolExecutor.java
java.util.concurrent.ThreadPoolExecutor
getTask
false
ThreadPoolExecutor.java
java.util.concurrent.ThreadPoolExecutor
runWorker
false
ThreadPoolExecutor.java
java.util.concurrent.ThreadPoolExecutor$Worker
run
false
Thread.java
java.lang.Thread
run
false


18:CreationSystem-akka.actor.default-dispatcher-4 is daemon:false
Unsafe.java
sun.misc.Unsafe
park
true
ForkJoinPool.java
scala.concurrent.forkjoin.ForkJoinPool
scan
false
ForkJoinPool.java
scala.concurrent.forkjoin.ForkJoinPool
runWorker
false
ForkJoinWorkerThread.java
scala.concurrent.forkjoin.ForkJoinWorkerThread
run
false


12:C3P0PooledConnectionPoolManager[identityToken->1hge24797149gw291ezhx58|6badc6a5]-HelperThread-#0
 
is daemon:true
Object.java
java.lang.Object
wait
true
ThreadPoolAsynchronousRunner.java
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread
run
false


22:pool-3-thread-3 is daemon:false
Unsafe.java
sun.misc.Unsafe
park
true
LockSupport.java
java.util.concurrent.locks.LockSupport
park
false
AbstractQueuedSynchronizer.java
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject
await
false
ScheduledThreadPoolExecutor.java
java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue
take
false
ScheduledThreadPoolExecutor.java
java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue
take
false
ThreadPoolExecutor.java
java.util.concurrent.ThreadPoolExecutor
getTask
false
ThreadPoolExecutor.java
java.util.concurrent.ThreadPoolExecutor
runWorker
false
ThreadPoolExecutor.java
java.util.concurrent.ThreadPoolExecutor$Worker
run
false
Thread.java
java.lang.Thread
run
false


28:Keep-Alive-Timer is daemon:true
Thread.java
java.lang.Thread
sleep
true
KeepAliveCache.java
sun.net.www.http.KeepAliveCache
run
false
Thread.java
java.lang.Thread
run
false


4:Signal Dispatcher is daemon:true

---