Uploaded image for project: 'ActiveMQ'
  1. ActiveMQ
  2. AMQ-2413

Hangs possible because of Queue.doPageIn



    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 5.4.0
    • 5.3.0
    • Broker
    • None
    • 5.4 branch 818147. Some changes after this hide this error, but I'm still concerned it might be a problem.

    • Patch Available


      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.

          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);

      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


        1. AMQ-2413patch.txt
          20 kB
          Colin MacNaughton



            rajdavies Robert Davies
            cmacnaug Colin MacNaughton
            0 Vote for this issue
            0 Start watching this issue