[ 
https://issues.apache.org/jira/browse/AMQ-8068?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jean-Baptiste Onofré reassigned AMQ-8068:
-----------------------------------------

    Assignee: Jean-Baptiste Onofré

> Topic memory leak on message eviction using 
> UniquePropertyMessageEvictionStrategy
> ---------------------------------------------------------------------------------
>
>                 Key: AMQ-8068
>                 URL: https://issues.apache.org/jira/browse/AMQ-8068
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 5.16.0
>            Reporter: Fraser Crossman
>            Assignee: Jean-Baptiste Onofré
>            Priority: Major
>             Fix For: 5.x
>
>         Attachments: patchfile.txt
>
>
> The current implementation of UniquePropertyMessageEvictionStrategy does not 
> conform to the expected behaviour of a MessageEvictionStrategySupport 
> implementation resulting in a memory leak.
> All MessageEvictionStrategySupport implementations remove from the passed 
> list of MessageReference objects the messages that should be evicted and then 
> returns those items in an array. The calling code expects this to be the case 
> and decrements message reference counters accordingly.
> The current implementation of UniquePropertyMessageEvictionStrategy does one 
> of two things depending on the state of the buffered messages:
>  # If the buffer already contains a single message per unique property then 
> the oldest message is returned in the array for message removal but is not 
> removed from the passed message list. This leaves a reference to the message 
> intended for removal in the passed message reference list - not intended 
> behaviour. (i.e. intended behaviour is identical to 
> OldestMessageEvictionStrategy)
>  # If the buffer contains more than one instance of a message with the same 
> unique property then only the latest messages (largest timestamp) for each of 
> those sets are removed from the passed list of message references. At this 
> point, the passed list of message references contains all the messages we 
> expect to be removed so it is converted to an array and returned. But this 
> list should contain all those messages that should be retained - not intended 
> behaviour.
> The patch contains the necessary changes to 
> UniquePropertyMessageEvictionStrategy to prevent this memory leak and an 
> assertion added to the UniquePropertyMessageEvictionStrategyTest.testEviction 
> to demonstrate the memory is correctly freed after applying the fix.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to