activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From TonyLeigh <tle...@ndsuk.com>
Subject Consumer blocking when session created on same connection as blocked producer
Date Mon, 26 Feb 2007 17:48:23 GMT

Hello All,

I've been struggling with a problem of ActiveMQ locking up with a
combination of fast producers and slow consumers.  After trawling through
the threads I think I understand what is happening and why the lockup
occurs, but I can only solve the lockup with two connections when it seems
that one should work.  

The situation is that I have a  http://www.nabble.com/file/6787/Client.java
Client.java 
 making large requests as a fast producer and a 
http://www.nabble.com/file/6788/Server.java Server.java  acting as a slow
consumer.

If you run the examples with a standard broker configuration the broker will
lock up due to lack of memory as the consumer in the sender cannot consume
messages as it needs to produce a reply inorder to send an ack.  If you
change the broker config to limit the memory per queue:

    <destinationPolicy>
      <policyMap><policyEntries>
          <policyEntry queue="TEST.>" memoryLimit="20000"/>
          <policyEntry queue="TEST.SERVER.IN" memoryLimit="10000"/>
      </policyEntries></policyMap>
    </destinationPolicy>

Then the broker does not lock up and the server is able to produce messages
to the client input queue.

The problem is that the consumer in the client will block and not receive
messages from the client queue if the consumer (and session) were created
from the same connection as the producer.  If a separate connection is used
then the client consumer will always consumer messages and the system does
not lock.

Why do I need a separate connection for the client consumer?  According to
the JMS spec a session should create a separate thread for message
consumption so the client should not block on consumption even if message
production is blocked.

Thanks,

Tony


-- 
View this message in context: http://www.nabble.com/Consumer-blocking-when-session-created-on-same-connection-as-blocked-producer-tf3294332s2354.html#a9163565
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message