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

Setting OptimiseAcknowledge on a queue with a prefetch limit causes normal/fast consumers to miss messages when a slow consumer is blocking

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Not A Problem
    • 5.5.0
    • 5.6.0
    • Broker
    • None
    • Java: 1.6.0_26-b03-383.jdk

    Description

      The attached test case tests slow consumer handling with a variety of topic policies and SessionFactory/ConnectionFactory settings. The expectation is that a normal (i.e. fast) consumer will continue to receive messages whilst a slow consumer is blocking.

      Without a prefetch limit, the expected behaviour is seen with setOptimizeAcknowledge both true and false.

      If a prefetch limit is set, setOptimizeAcknowledge(true) causes the normal/fast consumer to miss messages whilst the slow consumer is blocking.

      Would be nice to be able to turn on OptimiseAcknowledge for performance reasons, however it is also necessary to set the prefetch limit in order to trigger SlowConsumerStrategy/MessageEvictionStrategySupport logic.

      testDefaultSettings
      Publisher: Send 0
      SlowConsumer: Receive 0
      FastConsumer: Receive 0
      testDefaultSettings: Publisher Sent: 30 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]
      testDefaultSettings: Whilst slow consumer blocked:
      		- SlowConsumer Received: 1 [0]
      		- FastConsumer Received: 30 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]
      testDefaultSettings: After slow consumer unblocked:
      		- SlowConsumer Received: 30 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]
      		- FastConsumer Received: 30 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]
      
      testDefaultSettingsWithOptimiseAcknowledge
      testDefaultSettingsWithOptimiseAcknowledge: Publisher Sent: 30 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]
      testDefaultSettingsWithOptimiseAcknowledge: Whilst slow consumer blocked:
      		- SlowConsumer Received: 1 [0]
      		- FastConsumer Received: 30 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]
      testDefaultSettingsWithOptimiseAcknowledge: After slow consumer unblocked:
      		- SlowConsumer Received: 30 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]
      		- FastConsumer Received: 30 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]
      
      testBounded
      testBounded: Publisher Sent: 30 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]
      testBounded: Whilst slow consumer blocked:
      		- SlowConsumer Received: 1 [0]
      		- FastConsumer Received: 30 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]
      testBounded: After slow consumer unblocked:
      		- SlowConsumer Received: 10 [0, 1, 2, 3, 4, 25, 26, 27, 28, 29]
      		- FastConsumer Received: 30 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]
      
      testBoundedWithOptimiseAcknowledge
      testBoundedWithOptimiseAcknowledge: Publisher Sent: 30 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]
      testBoundedWithOptimiseAcknowledge: Whilst slow consumer blocked:
      		- SlowConsumer Received: 1 [0]
      		- FastConsumer Received: 5 [0, 1, 2, 3, 4]
      testBoundedWithOptimiseAcknowledge: After slow consumer unblocked:
      		- SlowConsumer Received: 5 [0, 1, 2, 3, 4]
      		- FastConsumer Received: 5 [0, 1, 2, 3, 4]
      
      java.lang.AssertionError: Fast consumer missed messages whilst slow consumer was blocking expected:<[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]> but was:<[0, 1, 2, 3, 4]>
      

      Attachments

        Issue Links

          Activity

            People

              gtully Gary Tully
              furn James Furness
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: