[ https://issues.apache.org/jira/browse/AMQ-9698?focusedWorklogId=968676&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-968676 ]
ASF GitHub Bot logged work on AMQ-9698: --------------------------------------- Author: ASF GitHub Bot Created on: 06/May/25 15:29 Start Date: 06/May/25 15:29 Worklog Time Spent: 10m Work Description: mattrpav commented on code in PR #1423: URL: https://github.com/apache/activemq/pull/1423#discussion_r2075734594 ########## activemq-broker/src/main/java/org/apache/activemq/broker/region/Topic.java: ########## @@ -826,14 +830,61 @@ protected void dispatch(final ConnectionContext context, Message message) throws } private final AtomicBoolean expiryTaskInProgress = new AtomicBoolean(false); - private final Runnable expireMessagesWork = new Runnable() { - @Override - public void run() { - List<Message> browsedMessages = new InsertionCountList<Message>(); - doBrowse(browsedMessages, getMaxExpirePageSize()); + private final Runnable expireMessagesWork = () -> { + try { Review Comment: Great! Issue Time Tracking ------------------- Worklog Id: (was: 968676) Time Spent: 1.5h (was: 1h 20m) > 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: 1.5h > 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 (topic > subs don't keep references after dispatch and there's no store to ack). > 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: issues-unsubscr...@activemq.apache.org For additional commands, e-mail: issues-h...@activemq.apache.org For further information, visit: https://activemq.apache.org/contact