You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Bharath Ganesh (JIRA)" <ji...@apache.org> on 2008/06/02 08:39:45 UTC

[jira] Created: (CXF-1621) Memory Leak in WSDLManagerImpl - SchemaCacheMap

Memory Leak in WSDLManagerImpl - SchemaCacheMap
-----------------------------------------------

                 Key: CXF-1621
                 URL: https://issues.apache.org/jira/browse/CXF-1621
             Project: CXF
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.0.6, 2.1
            Reporter: Bharath Ganesh
            Assignee: Bharath Ganesh


The schemaCacheMap in WSDLManagerImpl has a weak key - WSDLDefinition and value ServiceSchemaInfo. A key,value pair is inserted into this map while building a service. The entry is never explicitly removed from this map. Since the map is a WeakHashMap, it is assumed that when the key WSDLDefinition is weakly referenced, the entry would be removed from the map. But it is seen that the value ServiceSchemaInfo(the value) holds on to a SchemaInfo which in turn holds on to the ServiceInfo, which holds the WSDLDefinition through the AbstractPropertiesHolder.
This would mean that the value of the CacheMap always strongly refers to the key, which would mean the entry would never be removed from the map.
"The value objects in a WeakHashMap are held by ordinary strong references. Thus care should be taken to ensure that value objects do not strongly refer to their own keys, either directly or indirectly, since that will prevent the keys from being discarded"

This would mean ServiceInfo, OperationInfo, BindingInfo, WSDLDefinition would all stay in the VM even after the endpoint is stopped.


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


[jira] Resolved: (CXF-1621) Memory Leak in WSDLManagerImpl - SchemaCacheMap

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

Bharath Ganesh resolved CXF-1621.
---------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.7
                   2.1.1

http://www.nabble.com/Memory-Leak-at-WSDLManagerImpl-td17579537.html

The schemaCacheMap will now always have a weak value (This will be done by putting a WeakReference of the
ServiceSchemaInfo in the map). 

> Memory Leak in WSDLManagerImpl - SchemaCacheMap
> -----------------------------------------------
>
>                 Key: CXF-1621
>                 URL: https://issues.apache.org/jira/browse/CXF-1621
>             Project: CXF
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.1, 2.0.6
>            Reporter: Bharath Ganesh
>            Assignee: Bharath Ganesh
>             Fix For: 2.1.1, 2.0.7
>
>
> The schemaCacheMap in WSDLManagerImpl has a weak key - WSDLDefinition and value ServiceSchemaInfo. A key,value pair is inserted into this map while building a service. The entry is never explicitly removed from this map. Since the map is a WeakHashMap, it is assumed that when the key WSDLDefinition is weakly referenced, the entry would be removed from the map. But it is seen that the value ServiceSchemaInfo(the value) holds on to a SchemaInfo which in turn holds on to the ServiceInfo, which holds the WSDLDefinition through the AbstractPropertiesHolder.
> This would mean that the value of the CacheMap always strongly refers to the key, which would mean the entry would never be removed from the map.
> "The value objects in a WeakHashMap are held by ordinary strong references. Thus care should be taken to ensure that value objects do not strongly refer to their own keys, either directly or indirectly, since that will prevent the keys from being discarded"
> This would mean ServiceInfo, OperationInfo, BindingInfo, WSDLDefinition would all stay in the VM even after the endpoint is stopped.

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


[jira] Commented: (CXF-1621) Memory Leak in WSDLManagerImpl - SchemaCacheMap

Posted by "Bharath Ganesh (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1621?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12605366#action_12605366 ] 

Bharath Ganesh commented on CXF-1621:
-------------------------------------

Verified the memory leak fixes by profiling JAX-WS server and client runtime. Also the complete Java EE TCK (JAX-WS 2.0 on CXF 2.0.7 snapshot) runs in a single run with around 200M heap size. All looks OK.

> Memory Leak in WSDLManagerImpl - SchemaCacheMap
> -----------------------------------------------
>
>                 Key: CXF-1621
>                 URL: https://issues.apache.org/jira/browse/CXF-1621
>             Project: CXF
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.1, 2.0.6
>            Reporter: Bharath Ganesh
>            Assignee: Bharath Ganesh
>             Fix For: 2.1.1, 2.0.7
>
>
> The schemaCacheMap in WSDLManagerImpl has a weak key - WSDLDefinition and value ServiceSchemaInfo. A key,value pair is inserted into this map while building a service. The entry is never explicitly removed from this map. Since the map is a WeakHashMap, it is assumed that when the key WSDLDefinition is weakly referenced, the entry would be removed from the map. But it is seen that the value ServiceSchemaInfo(the value) holds on to a SchemaInfo which in turn holds on to the ServiceInfo, which holds the WSDLDefinition through the AbstractPropertiesHolder.
> This would mean that the value of the CacheMap always strongly refers to the key, which would mean the entry would never be removed from the map.
> "The value objects in a WeakHashMap are held by ordinary strong references. Thus care should be taken to ensure that value objects do not strongly refer to their own keys, either directly or indirectly, since that will prevent the keys from being discarded"
> This would mean ServiceInfo, OperationInfo, BindingInfo, WSDLDefinition would all stay in the VM even after the endpoint is stopped.

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


[jira] Commented: (CXF-1621) Memory Leak in WSDLManagerImpl - SchemaCacheMap

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1621?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12604037#action_12604037 ] 

Daniel Kulp commented on CXF-1621:
----------------------------------


Bharath,

This caused a NPE when building the system tests on a couple a my machines.   Basically, the CORBA utils have the manager create a Definition and a builder then builds the schemas and stuff for it and add to the cache.  However, the builder is discarded so nothing at all was holding onto the Schemas strongly and they got garbage collected before the CORBA utils could grab them.  Not all machines, but it did on my Mac.  :-)

I flipped the schemaCache to using the same keys as the definitionsCache.   That fixed that.

However, after I did that, I discovered the ServiceInfo in the SchemaInfo was never used at all.   It wasn't needed.  Thus, I yanked it.   That should also fix it.

In anycase, I'd appreciate a verification.  



> Memory Leak in WSDLManagerImpl - SchemaCacheMap
> -----------------------------------------------
>
>                 Key: CXF-1621
>                 URL: https://issues.apache.org/jira/browse/CXF-1621
>             Project: CXF
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.1, 2.0.6
>            Reporter: Bharath Ganesh
>            Assignee: Bharath Ganesh
>             Fix For: 2.1.1, 2.0.7
>
>
> The schemaCacheMap in WSDLManagerImpl has a weak key - WSDLDefinition and value ServiceSchemaInfo. A key,value pair is inserted into this map while building a service. The entry is never explicitly removed from this map. Since the map is a WeakHashMap, it is assumed that when the key WSDLDefinition is weakly referenced, the entry would be removed from the map. But it is seen that the value ServiceSchemaInfo(the value) holds on to a SchemaInfo which in turn holds on to the ServiceInfo, which holds the WSDLDefinition through the AbstractPropertiesHolder.
> This would mean that the value of the CacheMap always strongly refers to the key, which would mean the entry would never be removed from the map.
> "The value objects in a WeakHashMap are held by ordinary strong references. Thus care should be taken to ensure that value objects do not strongly refer to their own keys, either directly or indirectly, since that will prevent the keys from being discarded"
> This would mean ServiceInfo, OperationInfo, BindingInfo, WSDLDefinition would all stay in the VM even after the endpoint is stopped.

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


[jira] Commented: (CXF-1621) Memory Leak in WSDLManagerImpl - SchemaCacheMap

Posted by "Bharath Ganesh (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1621?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12603293#action_12603293 ] 

Bharath Ganesh commented on CXF-1621:
-------------------------------------

Sure will do that. On a vacation now. Will commit on monday..



> Memory Leak in WSDLManagerImpl - SchemaCacheMap
> -----------------------------------------------
>
>                 Key: CXF-1621
>                 URL: https://issues.apache.org/jira/browse/CXF-1621
>             Project: CXF
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.1, 2.0.6
>            Reporter: Bharath Ganesh
>            Assignee: Bharath Ganesh
>
> The schemaCacheMap in WSDLManagerImpl has a weak key - WSDLDefinition and value ServiceSchemaInfo. A key,value pair is inserted into this map while building a service. The entry is never explicitly removed from this map. Since the map is a WeakHashMap, it is assumed that when the key WSDLDefinition is weakly referenced, the entry would be removed from the map. But it is seen that the value ServiceSchemaInfo(the value) holds on to a SchemaInfo which in turn holds on to the ServiceInfo, which holds the WSDLDefinition through the AbstractPropertiesHolder.
> This would mean that the value of the CacheMap always strongly refers to the key, which would mean the entry would never be removed from the map.
> "The value objects in a WeakHashMap are held by ordinary strong references. Thus care should be taken to ensure that value objects do not strongly refer to their own keys, either directly or indirectly, since that will prevent the keys from being discarded"
> This would mean ServiceInfo, OperationInfo, BindingInfo, WSDLDefinition would all stay in the VM even after the endpoint is stopped.

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


[jira] Commented: (CXF-1621) Memory Leak in WSDLManagerImpl - SchemaCacheMap

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1621?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12603145#action_12603145 ] 

Daniel Kulp commented on CXF-1621:
----------------------------------


Any updates to this?   It would definitely be great to get a fix in for the 2.0.7/2.1.1 builds next week.  :-)



> Memory Leak in WSDLManagerImpl - SchemaCacheMap
> -----------------------------------------------
>
>                 Key: CXF-1621
>                 URL: https://issues.apache.org/jira/browse/CXF-1621
>             Project: CXF
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.1, 2.0.6
>            Reporter: Bharath Ganesh
>            Assignee: Bharath Ganesh
>
> The schemaCacheMap in WSDLManagerImpl has a weak key - WSDLDefinition and value ServiceSchemaInfo. A key,value pair is inserted into this map while building a service. The entry is never explicitly removed from this map. Since the map is a WeakHashMap, it is assumed that when the key WSDLDefinition is weakly referenced, the entry would be removed from the map. But it is seen that the value ServiceSchemaInfo(the value) holds on to a SchemaInfo which in turn holds on to the ServiceInfo, which holds the WSDLDefinition through the AbstractPropertiesHolder.
> This would mean that the value of the CacheMap always strongly refers to the key, which would mean the entry would never be removed from the map.
> "The value objects in a WeakHashMap are held by ordinary strong references. Thus care should be taken to ensure that value objects do not strongly refer to their own keys, either directly or indirectly, since that will prevent the keys from being discarded"
> This would mean ServiceInfo, OperationInfo, BindingInfo, WSDLDefinition would all stay in the VM even after the endpoint is stopped.

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