Uploaded image for project: 'ActiveMQ Artemis'
  1. ActiveMQ Artemis
  2. ARTEMIS-2156

Message Duplication when using exclusive divert and clustering

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.5.5, 2.6.3
    • 2.7.0
    • Broker
    • None

    Description

      We bumped into the following issue, we start getting duplicate message after doing some analysis we saw the "exclusiveBindings" in "org.apache.activemq.artemis.core.postoffice.impl.BindingsImpl" got the same binding twice.

      The if statement in "addBinding"

      if (binding.isExclusive()) {
         exclusiveBindings.add(binding);
      } else {
         SimpleString routingName = binding.getRoutingName();
      
         List<Binding> bindings = routingNameBindingMap.get(routingName);
      
         if (bindings == null) {
            bindings = new CopyOnWriteArrayList<>();
      
            List<Binding> oldBindings = routingNameBindingMap.putIfAbsent(routingName, bindings);
      
            if (oldBindings != null) {
               bindings = oldBindings;
            }
         }
      
         if (!bindings.contains(binding)) {
            bindings.add(binding);
         }
      }

      Does not do any check in case the binding already exists, this kind of test is done for non exclusive binding.

      I was not able to create an automatic test in the base code because the issue seems related to the client version.

      Scenario:

      • Cluster of two instances (UDP) Artemis Server 1.5.5
      • Clean Up /data/bindings/*, ../data/journal/*, ../data/paging/*
      • Exclusive Divert from jms.queue.*.Provider.*.Agent.*.Status to jms.queue.Notifications
      • Java program using artemis client
      • Start Consumer in Instance 1 (jms.queue.Notifications)
      • Send Message to Instance 1
      • Send Message to Instance 2
      • Send Message to Instance 1

      Expectations:

      • We expect to get 3 message

      Results:
      We got 3 messages when the client uses version 1.5.5
      We got 5 messages when the client uses version 2.6.2

       

      I enclose two gif one for client "org.apache.activemq:artemis-jms-client:1.5.5" where it works ok and another for "org.apache.activemq:artemis-jms-client:2.6.2" where you can appreciate the issue. 

      Also I enclose one screenshot where you can see the same object is added twice.

      I will also include the broker.xml file to configure the udp cluster + the code use for the producer and consumer.

      Note: The only difference when using client 1.5.5 is the queue name definition I needed to remove the jms.queue prefix.

      Attachments

        1. ArtemisClient1.5.5.gif
          3.90 MB
          Luis Miguel De Bello
        2. ArtemisClient2.6.2.gif
          3.81 MB
          Luis Miguel De Bello
        3. broker1.xml
          5 kB
          Luis Miguel De Bello
        4. broker1Server2-6-3.xml
          9 kB
          Luis Miguel De Bello
        5. broker2.xml
          5 kB
          Luis Miguel De Bello
        6. broker2Server2-6-3.xml
          9 kB
          Luis Miguel De Bello
        7. Consumer.java
          1 kB
          Luis Miguel De Bello
        8. ConsumerClient2-6-0.java
          1 kB
          Luis Miguel De Bello
        9. Duplicate Object.png
          1.34 MB
          Luis Miguel De Bello
        10. Producer.java
          1 kB
          Luis Miguel De Bello
        11. ProducerClient2-6-0.java
          1 kB
          Luis Miguel De Bello

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ldebello Luis Miguel De Bello
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 7h 10m
                  7h 10m