You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Gilad Garon (JIRA)" <ji...@apache.org> on 2008/11/25 16:55:44 UTC

[jira] Created: (WICKET-1959) PropertyResolver causes memory leaks with proxies

PropertyResolver causes memory leaks with proxies
-------------------------------------------------

                 Key: WICKET-1959
                 URL: https://issues.apache.org/jira/browse/WICKET-1959
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.3.5
         Environment: All Platforms
            Reporter: Gilad Garon


When using proxies for properties in wicket a memory leak occurs.
the classesToGetAndSetters ConcurrentHashMap doesn't have an eviction policy and fills up with proxies who do not get 
garbage collected.

Build a page which uses proxies as properties, every time a new session is initiated, a new proxy (a new proxy is a new class) of the same property is created and added to the map.
if the proxy is create by a remote jvm you also get a classloader leak.


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


[jira] Commented: (WICKET-1959) PropertyResolver causes memory leaks with proxies

Posted by "Johan Compagner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1959?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12658488#action_12658488 ] 

Johan Compagner commented on WICKET-1959:
-----------------------------------------

we dont have any sync code at the moment in that area (its all concurrent)
If we had to use weakhashmaps and so on then we needed to do that because there is no ConcurrentWeakHashmap implementation.

> PropertyResolver causes memory leaks with proxies
> -------------------------------------------------
>
>                 Key: WICKET-1959
>                 URL: https://issues.apache.org/jira/browse/WICKET-1959
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.5
>         Environment: All Platforms
>            Reporter: Gilad Garon
>            Assignee: Johan Compagner
>             Fix For: 1.3.6, 1.4-RC2
>
>
> When using proxies for properties, a memory leak occurs.
> The ConcurrentHashMap classesToGetAndSetters  doesn't have an eviction policy and fills up with proxies who do not get 
> garbage collected.
> Build a page which uses proxies as properties, every time a new session is initiated, a new proxy (a new proxy is a new class) of the same property is created and added to the map.
> if the proxy is create by a remote jvm you also get a classloader leak.

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


[jira] Closed: (WICKET-1959) PropertyResolver causes memory leaks with proxies

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

Johan Compagner closed WICKET-1959.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.4-RC2
                   1.3.6

you can now set the IClassCache and have your own eviction strategy

> PropertyResolver causes memory leaks with proxies
> -------------------------------------------------
>
>                 Key: WICKET-1959
>                 URL: https://issues.apache.org/jira/browse/WICKET-1959
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.5
>         Environment: All Platforms
>            Reporter: Gilad Garon
>            Assignee: Johan Compagner
>             Fix For: 1.3.6, 1.4-RC2
>
>
> When using proxies for properties, a memory leak occurs.
> The ConcurrentHashMap classesToGetAndSetters  doesn't have an eviction policy and fills up with proxies who do not get 
> garbage collected.
> Build a page which uses proxies as properties, every time a new session is initiated, a new proxy (a new proxy is a new class) of the same property is created and added to the map.
> if the proxy is create by a remote jvm you also get a classloader leak.

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


[jira] Assigned: (WICKET-1959) PropertyResolver causes memory leaks with proxies

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

Johan Compagner reassigned WICKET-1959:
---------------------------------------

    Assignee: Johan Compagner

> PropertyResolver causes memory leaks with proxies
> -------------------------------------------------
>
>                 Key: WICKET-1959
>                 URL: https://issues.apache.org/jira/browse/WICKET-1959
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.5
>         Environment: All Platforms
>            Reporter: Gilad Garon
>            Assignee: Johan Compagner
>
> When using proxies for properties, a memory leak occurs.
> The ConcurrentHashMap classesToGetAndSetters  doesn't have an eviction policy and fills up with proxies who do not get 
> garbage collected.
> Build a page which uses proxies as properties, every time a new session is initiated, a new proxy (a new proxy is a new class) of the same property is created and added to the map.
> if the proxy is create by a remote jvm you also get a classloader leak.

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


[jira] Commented: (WICKET-1959) PropertyResolver causes memory leaks with proxies

Posted by "Johan Compagner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1959?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12658409#action_12658409 ] 

Johan Compagner commented on WICKET-1959:
-----------------------------------------

i am looking into this problem but the fix is not that straightforward.

I can make it a WeakHashmap, but that one i must make synchronized what i rather dont want to do (it is hit many many times in 1 request over multiply requests)
So i could make it a ConcurrentHashMap with a WeakClassReference key, the code will be uglier then because every time i access the map with a class i have to wrap the class in that key.
But that even wouldnt help us at all because what the WeakClassKey then points to will be an hard reference to a ConcurrentMap with String->IGetAndSet
And implementations of IGetAndSet can hold references to that class (if it is an Array lookup) or Methods/Field variables of that class
So i have a hard reference to that same class so it will never be out of scope

To fix that so having weak references everywhere will make the code overly complex because then suddenly fields or methods can be null even when i have a IGetAndSet object...
so i have to take that into account all over the place thats horrible.

So the question do you really make constant proxy classes? How come? Why does a session needs a new class?

But I think for us the only real fix will be to have a static setter on PropertyResolver:

PropertyResolver.setClassCacheCreator(Application application, IClassCachCreator creator)


IClassCachCreator 
{
  public Map createCacheMap(Class clz);
}

then it is up to you to return a map with an evict policy or for a specific class dont return anything then it will not be cached at all.


> PropertyResolver causes memory leaks with proxies
> -------------------------------------------------
>
>                 Key: WICKET-1959
>                 URL: https://issues.apache.org/jira/browse/WICKET-1959
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.5
>         Environment: All Platforms
>            Reporter: Gilad Garon
>            Assignee: Johan Compagner
>
> When using proxies for properties, a memory leak occurs.
> The ConcurrentHashMap classesToGetAndSetters  doesn't have an eviction policy and fills up with proxies who do not get 
> garbage collected.
> Build a page which uses proxies as properties, every time a new session is initiated, a new proxy (a new proxy is a new class) of the same property is created and added to the map.
> if the proxy is create by a remote jvm you also get a classloader leak.

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


[jira] Commented: (WICKET-1959) PropertyResolver causes memory leaks with proxies

Posted by "Gilad Garon (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1959?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12658477#action_12658477 ] 

Gilad Garon commented on WICKET-1959:
-------------------------------------

That should work, thanks for the fix.
By the way, you could also use Google collections Mutlimap api instead to bypass all that ugly synchronized code.


> PropertyResolver causes memory leaks with proxies
> -------------------------------------------------
>
>                 Key: WICKET-1959
>                 URL: https://issues.apache.org/jira/browse/WICKET-1959
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.5
>         Environment: All Platforms
>            Reporter: Gilad Garon
>            Assignee: Johan Compagner
>             Fix For: 1.3.6, 1.4-RC2
>
>
> When using proxies for properties, a memory leak occurs.
> The ConcurrentHashMap classesToGetAndSetters  doesn't have an eviction policy and fills up with proxies who do not get 
> garbage collected.
> Build a page which uses proxies as properties, every time a new session is initiated, a new proxy (a new proxy is a new class) of the same property is created and added to the map.
> if the proxy is create by a remote jvm you also get a classloader leak.

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


[jira] Commented: (WICKET-1959) PropertyResolver causes memory leaks with proxies

Posted by "Johan Compagner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1959?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12650606#action_12650606 ] 

Johan Compagner commented on WICKET-1959:
-----------------------------------------

i guess we just should weakly references those classes

> PropertyResolver causes memory leaks with proxies
> -------------------------------------------------
>
>                 Key: WICKET-1959
>                 URL: https://issues.apache.org/jira/browse/WICKET-1959
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.5
>         Environment: All Platforms
>            Reporter: Gilad Garon
>
> When using proxies for properties, a memory leak occurs.
> The ConcurrentHashMap classesToGetAndSetters  doesn't have an eviction policy and fills up with proxies who do not get 
> garbage collected.
> Build a page which uses proxies as properties, every time a new session is initiated, a new proxy (a new proxy is a new class) of the same property is created and added to the map.
> if the proxy is create by a remote jvm you also get a classloader leak.

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


[jira] Updated: (WICKET-1959) PropertyResolver causes memory leaks with proxies

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

Gilad Garon updated WICKET-1959:
--------------------------------

    Description: 
When using proxies for properties, a memory leak occurs.
The ConcurrentHashMap classesToGetAndSetters  doesn't have an eviction policy and fills up with proxies who do not get 
garbage collected.

Build a page which uses proxies as properties, every time a new session is initiated, a new proxy (a new proxy is a new class) of the same property is created and added to the map.
if the proxy is create by a remote jvm you also get a classloader leak.


  was:
When using proxies for properties in wicket a memory leak occurs.
the classesToGetAndSetters ConcurrentHashMap doesn't have an eviction policy and fills up with proxies who do not get 
garbage collected.

Build a page which uses proxies as properties, every time a new session is initiated, a new proxy (a new proxy is a new class) of the same property is created and added to the map.
if the proxy is create by a remote jvm you also get a classloader leak.



> PropertyResolver causes memory leaks with proxies
> -------------------------------------------------
>
>                 Key: WICKET-1959
>                 URL: https://issues.apache.org/jira/browse/WICKET-1959
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.5
>         Environment: All Platforms
>            Reporter: Gilad Garon
>
> When using proxies for properties, a memory leak occurs.
> The ConcurrentHashMap classesToGetAndSetters  doesn't have an eviction policy and fills up with proxies who do not get 
> garbage collected.
> Build a page which uses proxies as properties, every time a new session is initiated, a new proxy (a new proxy is a new class) of the same property is created and added to the map.
> if the proxy is create by a remote jvm you also get a classloader leak.

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