[
https://issues.apache.org/jira/browse/ARTEMIS-2380?focusedWorklogId=289572&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-289572
]
ASF GitHub Bot logged work on ARTEMIS-2380:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 06/Aug/19 09:46
Start Date: 06/Aug/19 09:46
Worklog Time Spent: 10m
Work Description: wy96f 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_r310975418
##########
File path:
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
##########
@@ -1175,6 +1179,17 @@ public void addConsumer(final Consumer consumer) throws
Exception {
}
+ @Override
+ public void addLingerRef(Consumer consumer, MessageReference lingerRef)
throws Exception {
+ lingerRef.emptyConsumerID();
+ lingerRefMap.put(lingerRef, consumer);
Review comment:
@franz1981
> Beware putting `MessageReference` into a `Map`:
`MessageReferenceImpl::hashCode` relies on `getMessage().hashCode()` and
`CoreMessage::hashCode` will use the native hash code (like
`java.lang.System#identityHashCode`).
> It is known that it would break biased locking optimization on it (see
https://blogs.oracle.com/dave/biased-locking-in-hotspot for more detail): given
that `CoreMessage` heavily relies on `synchronized` operation, I would suggest
to measure the perf impact of it first
Thanks, franz. I'll have a look and measure the perf.
> On that note, need to ensure order is preserved hashmap looses any ordering
Good point. BTW, as i read from JMS spec, session is not thread safe, so
closing consumer and committing session from which consumer is created can't be
from multiple threads, correct? If not thread safe, the issue referred in this
PR should be happening rarely? Just not sure whether it's deserved to fix this
trivial problem by adding some tricky and fragile code.
----------------------------------------------------------------
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: 289572)
Time Spent: 40m (was: 0.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: 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
(v7.6.14#76016)