[ 
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 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)

  was:
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)


> 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 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


Reply via email to