You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "David Minor (JIRA)" <ji...@apache.org> on 2009/07/22 18:03:15 UTC

[jira] Created: (OPENJPA-1193) Memory leak when using FinalizingBrokerImpl

Memory leak when using FinalizingBrokerImpl
-------------------------------------------

                 Key: OPENJPA-1193
                 URL: https://issues.apache.org/jira/browse/OPENJPA-1193
             Project: OpenJPA
          Issue Type: Bug
          Components: kernel
    Affects Versions: 1.2.1, 1.2.0
         Environment: All environments where the finalizing broker is used
            Reporter: David Minor
             Fix For: 1.3.0, 2.0.0-M1


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 solution."

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.


[jira] Updated: (OPENJPA-1193) Memory leak when using FinalizingBrokerImpl

Posted by "Donald Woods (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1193?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Donald Woods updated OPENJPA-1193:
----------------------------------

    Fix Version/s:     (was: 2.0.0)
                   2.0.1

Saw build/test times for o-p-j go from 7:33 to 7:57 with the code change (when using in-mem Derby), so I'm deferring it for now from 2.0.0 and will reconsider in a maintenance release.

> Memory leak when using FinalizingBrokerImpl
> -------------------------------------------
>
>                 Key: OPENJPA-1193
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1193
>             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
>            Assignee: Donald Woods
>             Fix For: 1.3.0, 2.0.1
>
>         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 solution."
> 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.


[jira] Updated: (OPENJPA-1193) Memory leak when using FinalizingBrokerImpl

Posted by "Donald Woods (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1193?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Donald Woods updated OPENJPA-1193:
----------------------------------

    Fix Version/s:     (was: 2.0.0-M4)
                   2.0.0

> Memory leak when using FinalizingBrokerImpl
> -------------------------------------------
>
>                 Key: OPENJPA-1193
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1193
>             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
>            Assignee: Donald Woods
>             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 solution."
> 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.


[jira] Updated: (OPENJPA-1193) Memory leak when using FinalizingBrokerImpl

Posted by "Donald Woods (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1193?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Donald Woods updated OPENJPA-1193:
----------------------------------

    Patch Info: [Patch Available]

> Memory leak when using FinalizingBrokerImpl
> -------------------------------------------
>
>                 Key: OPENJPA-1193
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1193
>             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 solution."
> 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.


[jira] Updated: (OPENJPA-1193) Memory leak when using FinalizingBrokerImpl

Posted by "David Minor (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1193?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

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:
http://n2.nabble.com/Re-FW-Memory-leak-td3300148.html

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: https://issues.apache.org/jira/browse/OPENJPA-1193
>             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 solution."
> 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.


[jira] Commented: (OPENJPA-1193) Memory leak when using FinalizingBrokerImpl

Posted by "Donald Woods (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1193?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12755137#action_12755137 ] 

Donald Woods commented on OPENJPA-1193:
---------------------------------------

Committed to 1.3.x as r814782.
Needs performance/stress testing to ensure no regressions before committing to trunk.


> Memory leak when using FinalizingBrokerImpl
> -------------------------------------------
>
>                 Key: OPENJPA-1193
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1193
>             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 solution."
> 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.


[jira] Updated: (OPENJPA-1193) Memory leak when using FinalizingBrokerImpl

Posted by "Donald Woods (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1193?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Donald Woods updated OPENJPA-1193:
----------------------------------

    Fix Version/s:     (was: 2.0.0)
                   2.0.0-M4

> Memory leak when using FinalizingBrokerImpl
> -------------------------------------------
>
>                 Key: OPENJPA-1193
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1193
>             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
>            Assignee: Donald Woods
>             Fix For: 1.3.0, 2.0.0-M4
>
>         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 solution."
> 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.


[jira] Updated: (OPENJPA-1193) Memory leak when using FinalizingBrokerImpl

Posted by "Donald Woods (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1193?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Donald Woods updated OPENJPA-1193:
----------------------------------

    Fix Version/s:     (was: 2.0.0-M1)
                   2.0.0

> Memory leak when using FinalizingBrokerImpl
> -------------------------------------------
>
>                 Key: OPENJPA-1193
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1193
>             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
>
>
> 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 solution."
> 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.


[jira] Assigned: (OPENJPA-1193) Memory leak when using FinalizingBrokerImpl

Posted by "Donald Woods (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1193?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Donald Woods reassigned OPENJPA-1193:
-------------------------------------

    Assignee: Donald Woods

> Memory leak when using FinalizingBrokerImpl
> -------------------------------------------
>
>                 Key: OPENJPA-1193
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1193
>             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
>            Assignee: Donald Woods
>             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 solution."
> 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.


[jira] Updated: (OPENJPA-1193) Memory leak when using FinalizingBrokerImpl

Posted by "Donald Woods (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1193?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Donald Woods updated OPENJPA-1193:
----------------------------------

    Fix Version/s: 2.0.2
                   2.1.0
                       (was: 2.0.1)

> Memory leak when using FinalizingBrokerImpl
> -------------------------------------------
>
>                 Key: OPENJPA-1193
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1193
>             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
>            Assignee: Donald Woods
>             Fix For: 1.3.0, 2.0.2, 2.1.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 solution."
> 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.