activemq-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 王庆焕 (JIRA) <>
Subject [jira] [Commented] (AMQ-5016) BitArrayBin doesn't work well with index larger than Integer.MAX_VALUE
Date Fri, 16 Sep 2016 15:01:20 GMT


王庆焕 commented on AMQ-5016:

I downloaded activemq 5.11.0 source.jar, i found the only change is that firstIndex is declared
as long type. Then  I run the example :
public static void main(String[] args) {
       BitArrayBin toTest = new BitArrayBin(1024);
       //I  commented out the following code
       //toTest.setBit(1, true);       
       long largeNum = Integer.MAX_VALUE*2L +100L;
       toTest.setBit(largeNum, true);
the result  of running the above code is "false".  I expect the results to be true,but I got
a false

> BitArrayBin doesn't work well with index larger than Integer.MAX_VALUE
> ----------------------------------------------------------------------
>                 Key: AMQ-5016
>                 URL:
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: JMS client
>    Affects Versions: 5.9.0
>            Reporter: Dan Yu
>            Assignee: Gary Tully
>             Fix For: 5.11.0
>         Attachments:
> 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.
> {code}
> "ActiveMQ Session Task-869879" prio=10 tid=0x00007f412d6ee000 nid=0x3cbe runnable [0x00007f405b7b6000]
>    java.lang.Thread.State: RUNNABLE
>         at java.util.LinkedList.linkLast(
>         at java.util.LinkedList.add(
>         at org.apache.activemq.util.BitArrayBin.getBitArray(
>         at org.apache.activemq.util.BitArrayBin.setBit(
>         at org.apache.activemq.ActiveMQMessage AuditNoSync.isDuplicate(ActiveMQMessageAuditNoSyn
>         at org.apache.activemq.ActiveMQMessageAudit.isDuplicate(
>         - locked <0x00007f46a0138ab0> (a org.apache.activemq.ActiveMQMessageAudit)
>         at org.apache.activemq.ActiveMQMessage AuditNoSync.isDuplicate(ActiveMQMessageAuditNoSyn
>         at org.apache.activemq.ConnectionAudit.isDuplicate(
>         - locked <0x00007f4881e6b968> (a org.apache.activemq.ConnectionAudit)
>         at org.apache.activemq.ActiveMQConnection.isDuplicate(
>         at org.apache.activemq.ActiveMQMessageConsumer.dispatch(
>         - locked <0x00007f45db222fb8> (a java.lang.Object)
>         at org.apache.activemq.ActiveMQSessionExecutor.dispatch(
>         at org.apache.activemq.ActiveMQSessionExecutor.iterate(
>         at org.apache.activemq.thread.PooledTaskRunner.runTask(
>         at org.apache.activemq.thread.PooledTaskRunner$
>         at java.util.concurrent.ThreadPoolExecutor.runWorker(
>         at java.util.concurrent.ThreadPoolExecutor$
>         at
> {code}

This message was sent by Atlassian JIRA

View raw message