openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Minor (JIRA)" <>
Subject [jira] Updated: (OPENJPA-1193) Memory leak when using FinalizingBrokerImpl
Date Tue, 01 Sep 2009 23:09:32 GMT


David Minor updated OPENJPA-1193:

    Attachment: fix-finalizing-broker-memory-leak.patch

Attached is the patch that I believe was the original intent of this code, as mentioned in
the thread for this issue:

Since the original checkin cites an improvement for non-finalizing brokers, I believe the
concurrent hash map (plus code to remove the brokers from the hash map when being freed) was
meant for the non-finalizing broker, but a missing ! reversed the logic.

> Memory leak when using FinalizingBrokerImpl
> -------------------------------------------
>                 Key: OPENJPA-1193
>                 URL:
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 1.2.0, 1.2.1
>         Environment: All environments where the finalizing broker is used
>            Reporter: David Minor
>             Fix For: 1.3.0, 2.0.0
>         Attachments: fix-finalizing-broker-memory-leak.patch
> When FinalizingBrokerImpl is used, AbstractBrokerFactory uses a set backed by java's
ConcurrentHashMap to keep track of brokers, rather than a weak reference org.apache.openjpa.lib.util.concurrent.ConcurrentReferenceHashSet
as it did previously. This can lead to a memory leak if the brokers are never removed from
the Set.
> The change was originally checked in by Patrick Linskey in revision 653000 with the comment
"Improve concurrency by actively managing AbstractBrokerFactory's broker set when using non-finalizing
brokers. Credit goes to Arunabh Hazarika for identifying the bottleneck and prototyping this
> Changing the _brokers Set back to a weak reference ConcurrentReferenceHashSet fixes the
memory leak.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message