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

BitArrayBin doesn't work well with index larger than Integer.MAX_VALUE

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 5.9.0
    • 5.11.0
    • JMS client
    • None

    Description

      In BitArrayBin class, the index's unit type is long. It also has a variable called firstIndex, which store the index where the window starts. And that firstindex's unit is int. If the index is bigger than Integer.MAX_VALUE, setBit() and getBit() starts to return bad value.

      The defect causes activemq client to perform badly when receiving message that sequence id is bigger than max interger. It spends most of the time to shift window, and also blocks other consumer threads. Below is the jstack log that shows the problem.

      "ActiveMQ Session Task-869879" prio=10 tid=0x00007f412d6ee000 nid=0x3cbe runnable [0x00007f405b7b6000]
         java.lang.Thread.State: RUNNABLE
              at java.util.LinkedList.linkLast(LinkedList.java:140)
              at java.util.LinkedList.add(LinkedList.java:336)
              at org.apache.activemq.util.BitArrayBin.getBitArray(BitArrayBin.java:123)
              at org.apache.activemq.util.BitArrayBin.setBit(BitArrayBin.java:59)
              at org.apache.activemq.ActiveMQMessage AuditNoSync.isDuplicate(ActiveMQMessageAuditNoSyn c.java:160)
              at org.apache.activemq.ActiveMQMessageAudit.isDuplicate(ActiveMQMessageAudit.java:59)
              - locked <0x00007f46a0138ab0> (a org.apache.activemq.ActiveMQMessageAudit)
              at org.apache.activemq.ActiveMQMessage AuditNoSync.isDuplicate(ActiveMQMessageAuditNoSyn c.java:140)
              at org.apache.activemq.ConnectionAudit.isDuplicate(ConnectionAudit.java:52)
              - locked <0x00007f4881e6b968> (a org.apache.activemq.ConnectionAudit)
              at org.apache.activemq.ActiveMQConnection.isDuplicate(ActiveMQConnection.java:2291)
              at org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:1223)
              - locked <0x00007f45db222fb8> (a java.lang.Object)
              at org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:134)
              at org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:205)
              at org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:127)
              at org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:48)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
              at java.lang.Thread.run(Thread.java:722)
      

      Attachments

        1. BitArrayBinTest.java
          0.4 kB
          Dan Yu

        Issue Links

          Activity

            People

              gtully Gary Tully
              susu119 Dan Yu
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: