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

Modifying an existing Durable subscription blocks that subscription from receiving messages

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Cannot Reproduce
    • 5.2.0
    • None
    • None
    • None
    • Windows XPSP3

    Description

      When modifying an existing durable subscription, for example to change selectors, that subscription no longer gets any messages and error messages are produced.

      Juni test case attached and broker output with log level set to TRACE, which is based on the ProducerTool and ConsumerTool examples.

      Sequence to produce the problem is

      1. Clean data directory
      2. Run test case testConsumeWithNoSelectors - this creates the topic and blocks waiting for messages
      3. Run test case testProduceWithProperties - this creates 6 messages each with a single String property. First 2 have "selectorProp = 0", second 2 have value 1 and third pair have value 0 again. Consumer test case in (2) will consume messages and exit.
      4. Run test case testConsumeWithSelectors - this changes the durable subscription and adds the selectorProp = '0' to the subscription.
      5. Run same test case as (3). The consumer will then receive the first 2 messages produced by this producer and then block as it changes the subscription to have selectorProp = '1'.

      At this point this would appear to be a problem. According to the JMS TopicSubscriber Javadocs

      "A client can change an existing durable subscription by creating a durable TopicSubscriber with the same name and a new topic and/or message selector. Changing a durable subscription is equivalent to unsubscribing (deleting) the old one and creating a new one. "

      so, if step (4) above has now changed the durable subscription to add a selector it still receives the first two messages from step 5, so from that, it appears that the broker is able to recognise this as a modification (although it is delete+create). So, when it then tried to make the modification to change the selector to "selectorProp = 1" and receive the next two it does not get any messages. So, I would expect that as it has now blocked waiting for messages with those properties, if I do

      6. Run same test case as (3)

      I would expect the middle two messages to be received by the blocked consumer, but no more messages are consumed and I get the following messages to the broker log

      ERROR RecoveryListenerAdapter - Message id ID:aconcagua-4821-1237761609609-0:0:1:1:3 could not be recovered from the data store - already dispatched

      This particular subscription for clientId and topic now seems to be blocked forever and messages posted to this topic can never be received by this subscriber.

      Attachments

        1. AMQ2174Test.java
          12 kB
          Gary Tully
        2. selector.log
          185 kB
          Antony Bowesman
        3. SelectorBugTest.java
          12 kB
          Antony Bowesman

        Activity

          People

            Unassigned Unassigned
            adb Antony Bowesman
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: