You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by liangwb2001 <li...@gmail.com> on 2013/12/10 02:47:28 UTC

activemq5.5 client high cpu usage

Hi, I have an activemq server, and an application prodected message; Last
Saturday, the activemq host computer was down, then the product application
, occupy 2-3 cpu 100%, even after the activemq restart again,  and now
everything is ok, but high cpu usage;
here is a jstack slice:
"ActiveMQ Task-2799" daemon prio=10 tid=0x00007fcfbc4b9000 nid=0x1de7
waiting on condition [0x00007fcf75b5b000]
   java.lang.Thread.State: TIMED_WAITING (parking)
	at sun.misc.Unsafe.park(Native Method)
	- parking to wait for  <0x0000000669fb2770> (a
java.util.concurrent.SynchronousQueue$TransferStack)
	at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:196)
	at
java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:424)
	at
java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:323)
	at java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:874)
	at
java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:945)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
	at java.lang.Thread.run(Thread.java:662)

"ActiveMQ Task-2789" daemon prio=10 tid=0x00007fcfbf0c0800 nid=0x1ba3
runnable [0x000000005a436000]
   java.lang.Thread.State: RUNNABLE
	at java.lang.Object.notifyAll(Native Method)
	at
org.apache.activemq.transport.failover.FailoverTransport.doReconnect(FailoverTransport.java:807)
	- locked <0x0000000669f9fe00> (a java.lang.Object)
	at
org.apache.activemq.transport.failover.FailoverTransport$2.iterate(FailoverTransport.java:137)
	- locked <0x0000000669f9fe18> (a java.lang.Object)
	at
org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:127)
	at
org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:48)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:662)

Thank you for attention.



--
View this message in context: http://activemq.2283324.n4.nabble.com/activemq5-5-client-high-cpu-usage-tp4675314.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: activemq5.5 client high cpu usage

Posted by liangwb2001 <li...@gmail.com>.
Thanks for your prompt, 5.9 is ok.



--
View this message in context: http://activemq.2283324.n4.nabble.com/activemq5-5-client-high-cpu-usage-tp4675314p4675433.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: activemq5.5 client high cpu usage

Posted by Christian Posta <ch...@gmail.com>.
wanna give 5.9 a try?  http://activemq.apache.org/activemq-590-release.html

On Wed, Dec 11, 2013 at 12:16 AM, liangwb2001 <li...@gmail.com> wrote:
> I think this is a multi thread sync bug of ActiveMQConnection, for example:
>         ExceptionListener exceptionListener = new ExceptionListener() {
>                 public onException(JMSException exception){
>                         conn.close;
>                 }
>         };
>
> Thread main :
> time 1. create a connection successfully;
> time 2. connection.setExceptionListener(exceptionListener);
> time 3. activemq server shutdown;
> time 4. send a message, learn activemq down state;
>
> Thread onAsyncException()'s new Runnable -- ActiveMQ Connection Executor:
> unconnected :
> time 5. ActiveMQConnection.close();
> time 6. throws javax.jms.JMSException on
> ActiveMQConnection.doSyncSendPacket();
>
> Thread onException()'s new Runnable -- ActiveMQ Connection Executor:
> unconnected :
> time 7. do nothing because of (!closing.get() && !closed.get()) == false;
>
> So, ServiceSupport.dispose(this.transport) wouldn't be inoked,
> FailoverTransport.reconnectTask wouldn't be shutdown;
> ActiveMQ Task wakeup for ever, and doReconnect() returned at
> ((connectedTransport.get() != null && !doRebalance) || disposed ||
> connectionFailure != null),
> and high cpu usage;
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/activemq5-5-client-high-cpu-usage-tp4675314p4675349.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.



-- 
Christian Posta
http://www.christianposta.com/blog
twitter: @christianposta

Re: activemq5.5 client high cpu usage

Posted by liangwb2001 <li...@gmail.com>.
I think this is a multi thread sync bug of ActiveMQConnection, for example:
	ExceptionListener exceptionListener = new ExceptionListener() {
		public onException(JMSException exception){
			conn.close;
		}
	};

Thread main :
time 1. create a connection successfully;
time 2. connection.setExceptionListener(exceptionListener);
time 3. activemq server shutdown;
time 4. send a message, learn activemq down state;

Thread onAsyncException()'s new Runnable -- ActiveMQ Connection Executor:
unconnected :
time 5. ActiveMQConnection.close();
time 6. throws javax.jms.JMSException on
ActiveMQConnection.doSyncSendPacket();

Thread onException()'s new Runnable -- ActiveMQ Connection Executor:
unconnected :
time 7. do nothing because of (!closing.get() && !closed.get()) == false;

So, ServiceSupport.dispose(this.transport) wouldn't be inoked,
FailoverTransport.reconnectTask wouldn't be shutdown;
ActiveMQ Task wakeup for ever, and doReconnect() returned at
((connectedTransport.get() != null && !doRebalance) || disposed ||
connectionFailure != null),
and high cpu usage;



--
View this message in context: http://activemq.2283324.n4.nabble.com/activemq5-5-client-high-cpu-usage-tp4675314p4675349.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: activemq5.5 client high cpu usage

Posted by liangwb2001 <li...@gmail.com>.
I think this maybe a multi thread sync bug of ActiveMQConnection, for
example:
Thread main :
time 1. create a connection successfully;
time 2. activemq server shutdown;
time 3. send a message, learn activemq down state;
time 4. ActiveMQConnection.close();
time 5. throws javax.jms.JMSException on
ActiveMQConnection.doSyncSendPacket();

Thread ActiveMQ Connection Executor: unconnected :
time 6. ActiveMQConnection.onException() begin;
time 7. do nothing because of (!closing.get() && !closed.get());

So, ServiceSupport.dispose(this.transport) wouldn't be inoked,
FailoverTransport.reconnectTask wouldn't be shutdown;
ActiveMQ Task wakeup for ever, and doReconnect() returned at
((connectedTransport.get() != null && !doRebalance) || disposed ||
connectionFailure != null),
and high cpu usage;



--
View this message in context: http://activemq.2283324.n4.nabble.com/activemq5-5-client-high-cpu-usage-tp4675314p4675348.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.