[ https://issues.apache.org/jira/browse/AMQ-9698?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Christopher L. Shannon updated AMQ-9698: ---------------------------------------- Description: There are several bugs related the broker handling expiration of persistent 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 A) go away when offline and B) when online don't keep references after dispatch and C) there's no topic store to ack. Note: This issue is specifically for fixing persistent messages on durable topic subs...the expiration of non-persistent messages is handled completely differently as part of the pending cursor so that would be something else to investigate separately if that is working. I also noticed that Topic subs may not handle advisories quite correctly when new messages are added and there is an eviction policy set, there might be an issue there that needs investigation. 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) was: There are several bugs related the broker handling expiration of persistent 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 A) go away when offline and B) when online 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). One other thing is that expiration of non-persistent messages is handled differently for topic subs and durables (not part of this thread) so that would be something else to investigate as well to see if that works right. 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) > Fix expiration of persistent 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 persistent > 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 A) go away when offline and B) when online > don't keep references after dispatch and C) there's no topic store to ack. > Note: This issue is specifically for fixing persistent messages on durable > topic subs...the expiration of non-persistent messages is handled completely > differently as part of the pending cursor so that would be something else to > investigate separately if that is working. I also noticed that Topic subs may > not handle advisories quite correctly when new messages are added and there > is an eviction policy set, there might be an issue there that needs > investigation. > 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