You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2021/04/06 10:17:31 UTC

[GitHub] [rocketmq] Kingdon1992 opened a new issue #2783: ThreadLocalIndex getAndIncrement return value may only have two values

Kingdon1992 opened a new issue #2783:
URL: https://github.com/apache/rocketmq/issues/2783


   BUG REPORT
   ![image](https://user-images.githubusercontent.com/42442066/113693142-de483380-9700-11eb-829f-987bed085518.png)
   
   1. When `index` reaches `Integer.MAX_VALUE`,the next value of `index` will be `Integer.MIN_VALUE`
   2. `Math.asb(Integer.MIN_VALUE)` will be `Integer.MIN_VALUE`
   3. Then `getAndIncrement()` return value will always be `Integer.MAX_VALUE` or `Integer.MIN_VALUE`
   4. Considering that the initial value of index is random, it can be very close to `Integer.MAX_VALUE` at the beginning
   5. Although there are multiple `MessageQueue` for the target topic, only two `MessageQueue` will actually be selected
       - pos=0
       - pos=Math.abs(Integer.MAX_VALUE) % this.messageQueueList.size();
   
   ![image](https://user-images.githubusercontent.com/42442066/113695761-d211a580-9703-11eb-8ba5-3ad6ff6d85bf.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] panzhi33 commented on issue #2783: ThreadLocalIndex getAndIncrement return value may only have two values

Posted by GitBox <gi...@apache.org>.
panzhi33 commented on issue #2783:
URL: https://github.com/apache/rocketmq/issues/2783#issuecomment-814632783


   Could you submit a PR to fix it?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] Kingdon1992 commented on issue #2783: ThreadLocalIndex getAndIncrement return value may only have two values

Posted by GitBox <gi...@apache.org>.
Kingdon1992 commented on issue #2783:
URL: https://github.com/apache/rocketmq/issues/2783#issuecomment-814711565


   Sorry, because I made a mistake, there are two records here, please refer to b78326d


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] duhenglucky closed issue #2783: ThreadLocalIndex getAndIncrement return value may only have two values

Posted by GitBox <gi...@apache.org>.
duhenglucky closed issue #2783:
URL: https://github.com/apache/rocketmq/issues/2783


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org