Hangs possible because of Queue.doPageIn
----------------------------------------

                 Key: AMQ-2413
                 URL: https://issues.apache.org/activemq/browse/AMQ-2413
             Project: ActiveMQ
          Issue Type: Bug
          Components: Broker
    Affects Versions: 5.4.0
         Environment: 5.4 branch 818147. Some changes after this hide this 
error, but I'm still concerned it might be a problem.
            Reporter: Colin MacNaughton
            Priority: Critical


I don't understand the intent of the following code in Queue.doPageIn() and in 
rev 818147 it was causing delivery to the consumer to get hung (temporarily 
until message expiration check kickstarts it again). See the commented out 
lines of code that determine how many messages to attempt to page in. 

{code}
    private List<QueueMessageReference> doPageIn(boolean force) throws 
Exception {
        List<QueueMessageReference> result = null;
        List<QueueMessageReference> resultList = null;
        synchronized(dispatchMutex) {
            //WHAT IS THIS DOING?
            //int toPageIn = getMaxPageSize() + Math.max(0, 
(int)destinationStatistics.getInflight().getCount()) -pagedInMessages.size();

            //DOES THIS MAKE MORE SENSE:
            int toPageIn = Math.min(getMaxPageSize(), messages.size());
            
            if (LOG.isDebugEnabled()) {
                LOG.debug(destination.getPhysicalName() + " toPageIn: "  + 
toPageIn + ", Inflight: "
                        + destinationStatistics.getInflight().getCount()
                        + ", pagedInMessages.size " + pagedInMessages.size());
            }
            
            //WHAT IS THIS DOING?
            //toPageIn = Math.max(0, Math.min(toPageIn, getMaxPageSize()));
                       
            if (isLazyDispatch()&& !force) {
                // Only page in the minimum number of messages which can be 
dispatched immediately.
                toPageIn = Math.min(getConsumerMessageCountBeforeFull(), 
toPageIn);
            }
   
{code}

It is definitely possible that I'm just not understanding the intent of the 
code, but whatever it is, it's not working, and consequently I'm not sure that 
the subsequent fixes on the branch have eliminated the problem. The attached 
patch contains both a unit test, that tests several combinations of ack mode, 
vm cursoring, and delivery mode, as well as version of Queue which should be 
applied against revirion 818147 -- this version has the fix commented out and 
preserves the buggy behavior

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to