activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bruce Snyder" <bruce.sny...@gmail.com>
Subject Re: Client threads hang if ActiveMQ dies
Date Thu, 08 Jan 2009 16:25:40 GMT
On Thu, Jan 8, 2009 at 8:51 AM, IBeaumont <IBeaumont@categoric.com> wrote:
>
> I'm running ActiveMQ on another machine and connecting via TCP.  If it dies
> (I press CTRL-C, or may get an out of memory error) while I'm processing
> messages then the consume gets stuck waiting for a message and never returns
> (I'm calling receiveNoWait).  This is the stack trace where it is stuck in
> jconsole...
>
> Name: WorkerThread for PIQ Server manager 39
> State: WAITING on java.lang.Object@47eb38
> Total blocked: 0  Total waited: 43
>
> Stack trace:
> java.lang.Object.wait(Native Method)
> java.lang.Object.wait(Object.java:485)
> org.apache.activemq.MessageDispatchChannel.dequeue(MessageDispatchChannel.java:75)
> org.apache.activemq.ActiveMQMessageConsumer.dequeue(ActiveMQMessageConsumer.java:412)
> org.apache.activemq.ActiveMQMessageConsumer.receiveNoWait(ActiveMQMessageConsumer.java:560)
> ….
>
>
> At the same time I may see another ActiveMQ thread waiting (and not sure if
> this is related or the cause)...
>
> Name: ActiveMQ Connection Worker: tcp://2000-serve-base/192.168.1.9:61616
> State: WAITING on
> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@16372aa
> Total blocked: 0  Total waited: 3
>
> Stack trace:
> sun.misc.Unsafe.park(Native Method)
> java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1925)
> java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:358)
> java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:946)
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:906)
> java.lang.Thread.run(Thread.java:619)
>
>
> This causes me 2 problems -
> 1. The client application can't cleanly shutdown as it is waiting for my
> consumer thread to finish.
> 2. If ActiveMQ restarts my client doesn't automatically reconnect becasue
> the consumer thread is still stuck.
>
> Any ideas?
>
> Ian
> This means that when active MQ is restarted my client cannot automatically

Are your clients using the failover transport to connect to the broker?

http://activemq.apache.org/failover-transport-reference.html

The failover transport provides automatic reconnection for clients
when a broker cycles.

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.org/
Apache Camel - http://activemq.org/camel/
Apache ServiceMix - http://servicemix.org/

Blog: http://bruceblog.org/

Mime
View raw message