You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Rob Godfrey (JIRA)" <ji...@apache.org> on 2012/05/09 15:23:49 UTC

[jira] [Commented] (QPID-3979) Last value queue memory leak

    [ https://issues.apache.org/jira/browse/QPID-3979?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13271399#comment-13271399 ] 

Rob Godfrey commented on QPID-3979:
-----------------------------------

In general the change looks good.  I have one comment in that I think the method

{noformat}
private AtomicReference<QueueEntry> getOrPutIfAbsent(final Object key, final AtomicReference<QueueEntry> referenceToValue) 
{ 
    AtomicReference<QueueEntry> latestValueReference = _latestValuesMap.putIfAbsent(key, referenceToValue); 
    if(latestValueReference == null) 
    {
        latestValueReference = _latestValuesMap.get(key);
    }
    return latestValueReference; 
}
{noformat}

may return null.  Which would result in an NPE in the code that calls this.  The null would occur in the very unlikely case that between the insert into the map, and the retrieval from the map a separate thread updates with a newer value, and then this value is consumed (and thus deleted).
                
> Last value queue memory leak
> ----------------------------
>
>                 Key: QPID-3979
>                 URL: https://issues.apache.org/jira/browse/QPID-3979
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Broker
>    Affects Versions: 0.12, 0.14, 0.16, 0.17
>            Reporter: Philip Harvey
>
> I have observed a memory leak when using a last value queue. 
> Upon investigation, it seems that this is due to a bug in the management of ConflationQueueList._latestValuesMap. This map is keyed by the configured conflation key. Whilst entries are correctly replaced when new messages arrive, they are never *deleted*. Therefore, an entry remains in the map for every key value that has ever existed.
> The problem is compounded by the fact that the retained ConflationQueueEntry's can reference other entries - that is how the linked list behaviour of the queue list is achieved. Therefore, retaining a single entry in the aforementioned map can cause a large number of other entries to remain in memory.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org