Uploaded image for project: 'AMQ Broker'
  1. AMQ Broker
  2. ENTMQBR-9861

Editing "divert" configuration on broker.xml file might cause DivertConfiguration object leak

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not a Bug
    • Icon: Major Major
    • None
    • AMQ 7.13.0.GA
    • broker-core
    • None
    • False
    • Hide

      None

      Show
      None
    • False
    • Moderate

      Editing "divert" configuration on broker.xml file might cause DivertConfiguration object leak. Here are the test steps:

      Defined following queues and divert on broker.xml file:

              <address name="testqueue1">
                  <anycast>
                     <queue name="testqueue1" />
                  </anycast>
               </address>
               <address name="testqueue2">
                  <anycast>
                     <queue name="testqueue2" />
                  </anycast>
               </address>
               <address name="testqueue3">
                  <anycast>
                     <queue name="testqueue3" />
                  </anycast>
               </address>
               <address name="testqueue4">
                  <anycast>
                     <queue name="testqueue4" />
                  </anycast>
               </address>
      
            <diverts>
               <divert name="divert1">
                  <routing-name>test1</routing-name>
                  <address>testqueue1</address>
                  <forwarding-address>testqueue4</forwarding-address>
                  <exclusive>true</exclusive>
               </divert>
            </diverts>
      

      I sent 10 messages to the testqueue1 and they were all diverted to the testqueue4. And then I edit it by only modifying the divert name to:

            <diverts>
               <divert name="divert1-divert">
                  <routing-name>test1</routing-name>
                  <address>testqueue1</address>
                  <forwarding-address>testqueue4</forwarding-address>
                  <exclusive>true</exclusive>
               </divert>
            </diverts>
      

      After saving it, the broker reloaded it and then messages sent to the queue "testqueue1" were continuously diverted to the forwarding address "testqueue4".

      Finally, I edited it again by changing the divert name back to "divert1" and then the forwarding-address to the new address:

            <diverts>
               <divert name="divert1">
                  <routing-name>test1</routing-name>
                  <address>testqueue1</address>
                  <forwarding-address>testqueue2,testqueue3</forwarding-address>
                  <exclusive>true</exclusive>
               </divert>
            </diverts>
      

      Then both divert routes started to work. When I collected heap dump and I can see two DivertConfiguration objects in the heap dump:

      Class Name                                                                                                   | Shallow Heap | Retained Heap
      --------------------------------------------------------------------------------------------------------------------------------------------
      org.apache.activemq.artemis.core.config.DivertConfiguration @ 0x79a3e37d0                                    |           48 |            48
      |- <class&gt; class org.apache.activemq.artemis.core.config.DivertConfiguration @ 0x79a1eb020                   |           48 |           184
      |- address java.lang.String @ 0x79a390560  testqueue1                                                        |           24 |            56
      |- forwardingAddress java.lang.String @ 0x79a390618  testqueue4                                              |           24 |            56
      |- name java.lang.String @ 0x79a390700  divert1-divert                                                       |           24 |            56
      |- routingName java.lang.String @ 0x79a390778  test1                                                         |           24 |            48
      |- routingType org.apache.activemq.artemis.core.server.ComponentConfigurationRoutingType @ 0x79aa26048  STRIP|           24 |            24
      '- Total: 6 entries                                                                                          |              |              
      org.apache.activemq.artemis.core.config.DivertConfiguration @ 0x79aa25f40                                    |           48 |            48
      |- <class&gt; class org.apache.activemq.artemis.core.config.DivertConfiguration @ 0x79a1eb020                   |           48 |           184
      |- name java.lang.String @ 0x79aa25f70  divert1                                                              |           24 |            48
      |- routingName java.lang.String @ 0x79aa25fa0  test1                                                         |           24 |            48
      |- address java.lang.String @ 0x79aa25fd0  testqueue1                                                        |           24 |            56
      |- forwardingAddress java.lang.String @ 0x79aa26008  testqueue2,testqueue3                                   |           24 |            64
      |- routingType org.apache.activemq.artemis.core.server.ComponentConfigurationRoutingType @ 0x79aa26048  STRIP|           24 |            24
      '- Total: 6 entries                                                                                          |              |              
      --------------------------------------------------------------------------------------------------------------------------------------------
      

      The intermediate DivertConfiguration object with the name of "divert1-divert" was still active for some reason. I'd expect this object to be removed.

              dbruscin Domenico Francesco Bruscino
              rhn-support-qluo Joe Luo
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: