You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Filip Hanik - Dev Lists <de...@hanik.com> on 2008/05/01 01:02:03 UTC

OOME - ActiveMQMessageConsumer.unconsumedMessages

There doesnt seem to be a way of limiting how messages are delivered to 
the client.
the ActiveMQMessageConsumer.unconsumedMessages seems to fill up, all to 
quickly, and eventually cause an OOME

we have this setting on the server
<destinationPolicy> 
      <policyMap>
        <policyEntries>
          <policyEntry topic=">" producerFlowControl="false" 
memoryLimit="10mb">
            <deadLetterStrategy> 
              <sharedDeadLetterStrategy processExpired="false" 
processNonPersistent="false" /> 
            </deadLetterStrategy>
            <!--  10 seconds worth -->
            <!-- lets force old messages to be discarded for slow 
consumers -->
            <pendingMessageLimitStrategy>
              <constantPendingMessageLimitStrategy limit="1000"/>
            </pendingMessageLimitStrategy>
          </policyEntry>       
        </policyEntries>
      </policyMap>
    </destinationPolicy>


is there another setting to protect against this kind of OOME

Filip

Re: OOME - ActiveMQMessageConsumer.unconsumedMessages

Posted by Hiram Chirino <hi...@hiramchirino.com>.
can you make your test a junit and post it?  That way we can easily
reproduce your issue.

On Mon, May 12, 2008 at 4:53 PM, Filip Hanik - Dev Lists
<de...@hanik.com> wrote:
> Filip Hanik - Dev Lists wrote:
>>
>> Rob Davies wrote:
>>>
>>> On 1 May 2008, at 00:02, Filip Hanik - Dev Lists wrote:
>>>
>>>> There doesnt seem to be a way of limiting how messages are delivered to
>>>> the client.
>>>> the ActiveMQMessageConsumer.unconsumedMessages seems to fill up, all to
>>>> quickly, and eventually cause an OOME
>>>>
>>>> we have this setting on the server
>>>> <destinationPolicy>      <policyMap>
>>>>      <policyEntries>
>>>>        <policyEntry topic=">" producerFlowControl="false"
>>>> memoryLimit="10mb">
>>>>          <deadLetterStrategy>              <sharedDeadLetterStrategy
>>>> processExpired="false" processNonPersistent="false" />
>>>>  </deadLetterStrategy>
>>>>          <!--  10 seconds worth -->
>>>>          <!-- lets force old messages to be discarded for slow consumers
>>>> -->
>>>>          <pendingMessageLimitStrategy>
>>>>            <constantPendingMessageLimitStrategy limit="1000"/>
>>>>          </pendingMessageLimitStrategy>
>>>>        </policyEntry>              </policyEntries>
>>>>    </policyMap>
>>>>  </destinationPolicy>
>>>>
>>>>
>>>> is there another setting to protect against this kind of OOME
>>>>
>>>> Filip
>>>
>>> Hi Filip,
>>>
>>> You can override how many messages are delivered to a consumer by setting
>>> its prefetch limit - see the FAQ entry -
>>> http://activemq.apache.org/what-is-the-prefetch-limit-for.html
>>
>> hi Rob, yes I have that setting
>>
>> uri="tcp://127.0.0.1:61616?jms.prefetchPolicy.all=10&amp;wireFormat.maxInactivityDuration=0&amp;jms.redeliveryPolicy.maximumRedeliveries=-1"
>>
>> it's still downloading tons of messages to the client, I had to patch the
>> code itself
>>
>> in ActiveMQMessageConsumer.java I did
>>  synchronized (unconsumedMessages.getMutex()) {
>>   if (unconsumedMessages.size()>MAX_UNCONSUMED_MSGS) {
>>     Object o = unconsumedMessages.dequeueNoWait();
>>       if (LOG.isDebugEnabled()) {
>>         LOG.debug("Unconsumed message size too large, removing oldest
>> message:"+o);
>>       }
>>     }
>>     unconsumedMessages.enqueue(md);
>>  }
>>
>
>> this way I could drop messages on the client, but I was hoping there was a
>> server side config
>
> even client side code for prefetch doesn't take into effect
>
>           ActiveMQPrefetchPolicy pp = new ActiveMQPrefetchPolicy();
>           pp.setAll(10);
>           connectionFactory.setPrefetchPolicy(pp);
>
> and the system still OOME with unconsumedMessages being the cause of the
> problem
>
> activeMQ 5.0.0
>
> Filip
>>
>> Filip
>>>
>>>
>>>
>>>
>>> cheers,
>>>
>>> Rob
>>>
>>> http://open.iona.com/ -Enterprise Open Integration
>>> http://rajdavies.blogspot.com/
>>>
>>>
>>>
>>>
>>
>>
>
>



-- 
Regards,
Hiram

Blog: http://hiramchirino.com

Open Source SOA
http://open.iona.com

Re: OOME - ActiveMQMessageConsumer.unconsumedMessages

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
Filip Hanik - Dev Lists wrote:
> Rob Davies wrote:
>>
>> On 1 May 2008, at 00:02, Filip Hanik - Dev Lists wrote:
>>
>>> There doesnt seem to be a way of limiting how messages are delivered 
>>> to the client.
>>> the ActiveMQMessageConsumer.unconsumedMessages seems to fill up, all 
>>> to quickly, and eventually cause an OOME
>>>
>>> we have this setting on the server
>>> <destinationPolicy>      <policyMap>
>>>       <policyEntries>
>>>         <policyEntry topic=">" producerFlowControl="false" 
>>> memoryLimit="10mb">
>>>           <deadLetterStrategy>              
>>> <sharedDeadLetterStrategy processExpired="false" 
>>> processNonPersistent="false" />            </deadLetterStrategy>
>>>           <!--  10 seconds worth -->
>>>           <!-- lets force old messages to be discarded for slow 
>>> consumers -->
>>>           <pendingMessageLimitStrategy>
>>>             <constantPendingMessageLimitStrategy limit="1000"/>
>>>           </pendingMessageLimitStrategy>
>>>         </policyEntry>              </policyEntries>
>>>     </policyMap>
>>>   </destinationPolicy>
>>>
>>>
>>> is there another setting to protect against this kind of OOME
>>>
>>> Filip
>>
>> Hi Filip,
>>
>> You can override how many messages are delivered to a consumer by 
>> setting its prefetch limit - see the FAQ entry - 
>> http://activemq.apache.org/what-is-the-prefetch-limit-for.html
> hi Rob, yes I have that setting
> uri="tcp://127.0.0.1:61616?jms.prefetchPolicy.all=10&amp;wireFormat.maxInactivityDuration=0&amp;jms.redeliveryPolicy.maximumRedeliveries=-1" 
>
>
> it's still downloading tons of messages to the client, I had to patch 
> the code itself
>
> in ActiveMQMessageConsumer.java I did
>  synchronized (unconsumedMessages.getMutex()) {
>    if (unconsumedMessages.size()>MAX_UNCONSUMED_MSGS) {
>      Object o = unconsumedMessages.dequeueNoWait();
>        if (LOG.isDebugEnabled()) {
>          LOG.debug("Unconsumed message size too large, removing oldest 
> message:"+o);
>        }
>      }
>      unconsumedMessages.enqueue(md);
>  }
>

> this way I could drop messages on the client, but I was hoping there 
> was a server side config
even client side code for prefetch doesn't take into effect

            ActiveMQPrefetchPolicy pp = new ActiveMQPrefetchPolicy();
            pp.setAll(10);
            connectionFactory.setPrefetchPolicy(pp);

and the system still OOME with unconsumedMessages being the cause of the 
problem

activeMQ 5.0.0

Filip
>
> Filip
>>
>>
>>
>>
>> cheers,
>>
>> Rob
>>
>> http://open.iona.com/ -Enterprise Open Integration
>> http://rajdavies.blogspot.com/
>>
>>
>>
>>
>
>


Re: OOME - ActiveMQMessageConsumer.unconsumedMessages

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
Rob Davies wrote:
>
> On 1 May 2008, at 00:02, Filip Hanik - Dev Lists wrote:
>
>> There doesnt seem to be a way of limiting how messages are delivered 
>> to the client.
>> the ActiveMQMessageConsumer.unconsumedMessages seems to fill up, all 
>> to quickly, and eventually cause an OOME
>>
>> we have this setting on the server
>> <destinationPolicy>      <policyMap>
>>       <policyEntries>
>>         <policyEntry topic=">" producerFlowControl="false" 
>> memoryLimit="10mb">
>>           <deadLetterStrategy>              <sharedDeadLetterStrategy 
>> processExpired="false" processNonPersistent="false" />            
>> </deadLetterStrategy>
>>           <!--  10 seconds worth -->
>>           <!-- lets force old messages to be discarded for slow 
>> consumers -->
>>           <pendingMessageLimitStrategy>
>>             <constantPendingMessageLimitStrategy limit="1000"/>
>>           </pendingMessageLimitStrategy>
>>         </policyEntry>              </policyEntries>
>>     </policyMap>
>>   </destinationPolicy>
>>
>>
>> is there another setting to protect against this kind of OOME
>>
>> Filip
>
> Hi Filip,
>
> You can override how many messages are delivered to a consumer by 
> setting its prefetch limit - see the FAQ entry - 
> http://activemq.apache.org/what-is-the-prefetch-limit-for.html
hi Rob, yes I have that setting
uri="tcp://127.0.0.1:61616?jms.prefetchPolicy.all=10&amp;wireFormat.maxInactivityDuration=0&amp;jms.redeliveryPolicy.maximumRedeliveries=-1"

it's still downloading tons of messages to the client, I had to patch 
the code itself

in ActiveMQMessageConsumer.java I did
  synchronized (unconsumedMessages.getMutex()) {
    if (unconsumedMessages.size()>MAX_UNCONSUMED_MSGS) {
      Object o = unconsumedMessages.dequeueNoWait();
        if (LOG.isDebugEnabled()) {
          LOG.debug("Unconsumed message size too large, removing oldest 
message:"+o);
        }
      }
      unconsumedMessages.enqueue(md);
  }

this way I could drop messages on the client, but I was hoping there was 
a server side config

Filip
>
>
>
>
> cheers,
>
> Rob
>
> http://open.iona.com/ -Enterprise Open Integration
> http://rajdavies.blogspot.com/
>
>
>
>


Re: OOME - ActiveMQMessageConsumer.unconsumedMessages

Posted by Rob Davies <ra...@gmail.com>.
On 1 May 2008, at 00:02, Filip Hanik - Dev Lists wrote:

> There doesnt seem to be a way of limiting how messages are delivered  
> to the client.
> the ActiveMQMessageConsumer.unconsumedMessages seems to fill up, all  
> to quickly, and eventually cause an OOME
>
> we have this setting on the server
> <destinationPolicy>      <policyMap>
>       <policyEntries>
>         <policyEntry topic=">" producerFlowControl="false"  
> memoryLimit="10mb">
>           <deadLetterStrategy>               
> <sharedDeadLetterStrategy processExpired="false"  
> processNonPersistent="false" />            </deadLetterStrategy>
>           <!--  10 seconds worth -->
>           <!-- lets force old messages to be discarded for slow  
> consumers -->
>           <pendingMessageLimitStrategy>
>             <constantPendingMessageLimitStrategy limit="1000"/>
>           </pendingMessageLimitStrategy>
>         </policyEntry>              </policyEntries>
>     </policyMap>
>   </destinationPolicy>
>
>
> is there another setting to protect against this kind of OOME
>
> Filip

Hi Filip,

You can override how many messages are delivered to a consumer by  
setting its prefetch limit - see the FAQ entry - http://activemq.apache.org/what-is-the-prefetch-limit-for.html




cheers,

Rob

http://open.iona.com/ -Enterprise Open Integration
http://rajdavies.blogspot.com/