[ 
https://issues.apache.org/jira/browse/AMQ-3669?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claudio Corsi updated AMQ-3669:
-------------------------------

    Attachment: mirroredqueue.diffs

This patch contains a test and the fix to this issue.
                
> Pending producer with qMirror, messages are not spooled to disk
> ---------------------------------------------------------------
>
>                 Key: AMQ-3669
>                 URL: https://issues.apache.org/jira/browse/AMQ-3669
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker, Message Store
>    Affects Versions: 5.5.1
>         Environment: local test on windows, happens also on linux remotely
>            Reporter: Darius Schier
>         Attachments: mirroredqueue.diffs
>
>
> We fill a queue that is backed by a qmirror with data (persistent) that 
> exceeds the configured memory limit.
> The producer (producerFlowControl="true" at queue and qmirror) will be 
> throttled when the the limit is reached, no messages are spooled to disk.
> As an overall result, we are not able to write a lot of messages into amq.
> *Configuration:*
> {code:xml} 
>       <destinationInterceptors>
>               <mirroredQueue copyMessage = "true" postfix=".qmirror" 
> prefix=""/>
>       </destinationInterceptors>
>       <destinationPolicy>
>               <policyMap>
>                 <policyEntries>
>                       <policyEntry topic=">" producerFlowControl="true" 
> memoryLimit="2mb" />
>                       <policyEntry queue="created.static.for.persistent" 
> producerFlowControl="true" memoryLimit="1mb" />
>                 </policyEntries>
>               </policyMap>
>       </destinationPolicy> 
>       <destinations>
>               <queue physicalName="created.static.for.persistent" />
>       </destinations>
>       <persistenceAdapter>
>               <kahaDB directory="${activemq.base}/data/kahadb"/>
>       </persistenceAdapter>
>       
>       <systemUsage>
>               <systemUsage>
>                       <memoryUsage><memoryUsage limit="10 mb" /></memoryUsage>
>                       <storeUsage><storeUsage limit="100 mb"/></storeUsage>
>                       <tempUsage><tempUsage limit="100 mb"/></tempUsage>
>               </systemUsage>
>       </systemUsage>
>       
>       <transportConnectors>
>               <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
>       </transportConnectors>
>  {code}
> *Java test code:*
> {code} 
>     ActiveMQConnectionFactory factory = new 
> ActiveMQConnectionFactory("tcp://localhost:61616");
>     Connection connection = factory.createConnection("user", "pwd");
>     connection.start();
>     Session session = connection.createSession(false, 
> Session.CLIENT_ACKNOWLEDGE);
>     Destination destination = 
> session.createQueue("created.static.for.persistent");
>     MessageProducer producer = session.createProducer(destination);
>     producer.setDeliveryMode(DeliveryMode.PERSISTENT);
>     char[] m = new char[1024];
>     Arrays.fill(m, 'x');
>     // create some messages that have 1k each
>     for (int i = 0; i < 12000; i++) {
>       ActiveMQTextMessage message = new ActiveMQTextMessage();
>       message.setText(new String(m));
>       producer.send(message);
>     }
>     connection.stop();
>     connection.close();
>   }
> {code} 
> *Expectation:*
> Messages should be written to disk when the memory limit exceeds, all 
> messages should be available within the queue/topic.
> *Result:*
>  INFO | Usage Manager memory limit (2097152) reached for 
> topic://created.static.for.persistent.qmirror. Producers will be throttled to 
> the rate at which messages are removed from this destination to prevent 
> flooding it. See http://activemq.apache.org/producer-flow-control.html for 
> more info
> Store percent used  : 10 
> Memory percent used : 20
> Temp percent used   : 0
> Interesting: The smaller flow control for the queue (1mb) does not seem to 
> catch but the qmirror does (2mb).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to