[ 
https://issues.apache.org/jira/browse/ARTEMIS-2380?focusedWorklogId=304065&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-304065
 ]

ASF GitHub Bot logged work on ARTEMIS-2380:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 30/Aug/19 06:35
            Start Date: 30/Aug/19 06:35
    Worklog Time Spent: 10m 
      Work Description: michaelandrepearce commented on pull request #2703: 
ARTEMIS-2380 Fix delivering message in the case of consume close
URL: https://github.com/apache/activemq-artemis/pull/2703#discussion_r319371758
 
 

 ##########
 File path: 
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/MessageReferenceImpl.java
 ##########
 @@ -70,9 +70,7 @@ public int compare(MessageReference o1, MessageReference o2) 
{
 
    private final Queue queue;
 
-   private long consumerID;
-
-   private boolean hasConsumerID = false;
+   private long consumerID = -1L;
 
 
 Review comment:
   Would a simpler option be simply make this then Long object? If that truely 
is an issue. 
   
   That said with your solution the issue still applies though. You can call 
hasConsumerId returning true and then its cleared before getconsumerid, 
resulting in code getting a -1 consumer id, which is no different than barthing 
an exception. 
   
   If you truely wanted to be safe make it a Long and then remove the 
hasConsumerId method entirely adjusting all code to get the consumer id into a 
local var and then doing a null check on it. That said the issue still occurs 
that it could be emptied between doing the check and then doing soemthing with 
that reference still which maybe invalid. 
   
   This is why exception us currently thrown.
 
----------------------------------------------------------------
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:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 304065)
    Time Spent: 5h 40m  (was: 5.5h)

> Fix delivering message in the case of consume close
> ---------------------------------------------------
>
>                 Key: ARTEMIS-2380
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-2380
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>          Components: Broker
>            Reporter: yangwei
>            Priority: Major
>          Time Spent: 5h 40m
>  Remaining Estimate: 0h
>
> When consumer is closed and transaction is not committed or rollbacked, the 
> msg acked is not showed by delivering message but counted by delivering count.
> We add closed consumer if any message is acked but not committed or 
> rollbacked, and remove closed consumer if transaction is finished. In this 
> way, delivering messages can be properly retained.
> During calling hasCosnumer and getConsumerId, there is some race condition 
> that emptyConsumerId is called causing following getConsumerId throws 
> IllegalStateException. Also optimize it without extra effort.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Reply via email to