[
https://issues.apache.org/jira/browse/AMQ-9698?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17950020#comment-17950020
]
ASF subversion and git services commented on AMQ-9698:
------------------------------------------------------
Commit 9a1f00b0f0b44e8dd781367fdf32d311e4f75fd3 in activemq's branch
refs/heads/activemq-6.1.x from Christopher L. Shannon
[ https://gitbox.apache.org/repos/asf?p=activemq.git;h=9a1f00b0f0 ]
AMQ-9698 - Fix message expiration on durable subs (#1423)
This commit fixes multiple problems with handling message expiration on
durable topic subscriptions.
1) Memory usage tracking is fixed on expiration by correctly
decrementing the counter inside AbstractStoreCursor when calling the
remove(message) method, which was previously missed.
2) A new refrence type is used to wrap references in TopicStorePrefetch
so that if multiple subscriptions share a reference in their cursors
each one can expire the message. Previously only one would expire as the
message would be marked as expired and skipped.
3) On client expiration, the references are properly decremented so
memory tracking is correct.
4) The expiration thread for Topics has been improved to be much more
efficient for KahaDB by only scanning for expired messages if there are
durables eligible for expiration. The thread also now checks the index
to see if expired messages are associated with the subs still so we
don't expire the same sub multiple times. Only messages that need to
still be processed are returned which further cuts down memory usage.
(cherry picked from commit 4abcfa1ad6808ba6786cf402b4feedef3659d0a2)
> Fix expiration of messages on durable subscriptions
> ---------------------------------------------------
>
> Key: AMQ-9698
> URL: https://issues.apache.org/jira/browse/AMQ-9698
> Project: ActiveMQ Classic
> Issue Type: Bug
> Affects Versions: 5.19.0, 6.1.6
> Reporter: Christopher L. Shannon
> Assignee: Christopher L. Shannon
> Priority: Major
> Fix For: 6.2.0, 5.19.1, 6.1.7
>
> Time Spent: 1h 40m
> Remaining Estimate: 0h
>
> There are several bugs related the broker handling expiration of messages on
> Durable topic subscriptions, both when the client expires and also the broker
> expires. The bugs are related specifically to durables in both the expiration
> thread and the pending message cursor and don't apply to Topic subs because
> topic subs don't keep references after dispatch and there's no store to ack.
> (However, I did notice that Topic subs may not handle advisories quite
> correctly when new messages are added and there is an eviction policy set,
> there might be the same reference issue. I need to investigate that more and
> that would be a separate follow on Jira if a problem)
> The following issues exist:
> # *Skipping client expired acks:* If a client expires a message and sends
> back an expiration ack, the broker marks the message reference as expired.
> This means if multiple durable subs try and expire the same message and are
> using the same reference (this can happen when using caching in
> PendingMessageCursor) the first one will ack and the rest of the messages
> never get acked in the store. Furthermore, memory usage tracking is impacted
> as the counter isn't decremented.
> # *Memory tracking by the cursor:* AbstractStoreCursor does not decrement the
> usage counter on the message reference if removed using the
> cursor.remove(message) method. This causes the usage tracker to not decrement
> even after removal in some cases.
> # *Expiry thread:* The topic expiration thread has multiple problems.
> #* The thread is inefficient. It uses the browse method and just loads
> messages into the browse map even if there are no offline durables and
> iterates over every subscription.
> #* The thread will just expire the message on any offline durable or any
> durable that is marked to expire if online without taking into account
> whether the durable has already acked the message. This can lead to lots of
> warnings in the logs for unmatched acks if acking multiple times (which could
> happen if there was another online sub preventing the entire removal of the
> message)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact