You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by StefanL <st...@yahoo.se> on 2007/09/21 10:32:57 UTC

Producer and consumer hangs with specific scenario

We're having a strange problem in our environment when the consumer is not
receiving any 
more messages from the queue since the broker considers the consumer queue
filled to the
prefetch size and messages not acked though they are/should be. They are
received and handled by the consumer.

I have managed to reproduce the behaviour with slightly modified examples
from the binary distro. see attachment.

In short what's needed is that the consumer sends a message while the broker
queue is full, usage = 100 
and the prefetch is also reached.

To reproduce run the examples as they are on your system to get your max
queue size and check the jconsole figures.

cmd>  ant consumer -Dmax=100000 -DsleepTime=10
cmd>  ant producer -Dmax=100000

I get QueueSize = 8042 and that is the steady state, producer sends messages
as they are acked from 
the consumer and this can go on forever.
(Modify the message size, memory size etc and you can get other figures.)


Now use the attached ConsumerTool.java. 
The modification is that it creates a separate thread with a new jms session
on which it sends a heart 
beat message every 2 seconds. As long as the broker queue is not filled this
works fine, test this by using 

cmd>  ant consumer -Dmax=100000 
cmd>  ant producer -Dmax=100000 


Now make sure the broker queue gets filled by 
cmd>  ant consumer -Dmax=100000 -DsleepTime=2
cmd>  ant producer -Dmax=100000 

Now everything freezes 1000 messages after the most recent heart beat sent
by the consumer when the broker queue is full..
What happens? 

I've read the post
http://www.nabble.com/Consumer-blocking-when-session-created-on-same-connection-as-blocked-producer-tf3294332s2354.html
but in that scenario the answer is sent within onMessage and will of course
be blocked as the already blocked producer.
Here it's on a separate thread.

TIA /Stefan

http://www.nabble.com/file/p12812854/ConsumerTool.java ConsumerTool.java 

-- 
View this message in context: http://www.nabble.com/Producer-and-consumer-hangs-with-specific-scenario-tf4492569s2354.html#a12812854
Sent from the ActiveMQ - User mailing list archive at Nabble.com.