[
https://issues.apache.org/jira/browse/CXF-6632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14950315#comment-14950315
]
Giovanni Borelli edited comment on CXF-6632 at 10/9/15 12:40 PM:
-----------------------------------------------------------------
I managed to create a test case:
{code}
String urlStr = "http://my_server_url/path/to/wsdl&=";
Random rand = new Random();
while(true){
URL url = new URL(urlStr+rand.nextInt());
Service.create(url, new
QName("http://schemas.microsoft.com/sharepoint/soap/", "Lists"));
}
{code}
This creates a noticeable memory leak:
https://drive.google.com/file/d/0B5LMTi_mp6SedDlNTHpOT3RCSms/view?usp=sharing
Fixing the WSDLManagerImpl this way:
{code}
class FixedWSDLManagerImpl extends WSDLManagerImpl{
public FixedWSDLManagerImpl() throws BusException {
super();
}
@Override
public Definition getDefinition(String url) throws WSDLException {
return super.getDefinition(new String(url));
}
}
{code}
and using it in my test case:
{code}
String urlStr = "http://my_server_url/path/to/wsdl&=";
Random rand = new Random();
while(true){
URL url = new URL(urlStr+rand.nextInt());
BusFactory.getThreadDefaultBus().setExtension(new
FixedWSDLManagerImpl(), WSDLManager.class);
Service.create(url, new
QName("http://schemas.microsoft.com/sharepoint/soap/", "Lists"));
}
{code}
completely fixes the leak:
https://drive.google.com/file/d/0B5LMTi_mp6SeaDB5dWFPNTRGc28/view?usp=sharing
Hope this helps
was (Author: gio):
I managed to create a test case:
{code}
String urlStr = "http://my_server_url/path/to/wsdl&=";
Random rand = new Random();
while(true){
URL url = new URL(urlStr+rand.nextInt());
Service.create(url, new
QName("http://schemas.microsoft.com/sharepoint/soap/", "Lists"));
}
{code}
This creates a prominent memory leak:
https://drive.google.com/file/d/0B5LMTi_mp6SedDlNTHpOT3RCSms/view?usp=sharing
Fixing the WSDLManagerImpl this way:
{code}
class FixedWSDLManagerImpl extends WSDLManagerImpl{
public FixedWSDLManagerImpl() throws BusException {
super();
}
@Override
public Definition getDefinition(String url) throws WSDLException {
return super.getDefinition(new String(url));
}
}
{code}
and using it in my test case:
{code}
String urlStr = "http://my_server_url/path/to/wsdl&=";
Random rand = new Random();
while(true){
URL url = new URL(urlStr+rand.nextInt());
BusFactory.getThreadDefaultBus().setExtension(new
FixedWSDLManagerImpl(), WSDLManager.class);
Service.create(url, new
QName("http://schemas.microsoft.com/sharepoint/soap/", "Lists"));
}
{code}
completely fixes the leak:
https://drive.google.com/file/d/0B5LMTi_mp6SeaDB5dWFPNTRGc28/view?usp=sharing
Hope this helps
> Memory leak due to literal keys in WSDLDefinition map
> -----------------------------------------------------
>
> Key: CXF-6632
> URL: https://issues.apache.org/jira/browse/CXF-6632
> Project: CXF
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.7.17
> Reporter: Giovanni Borelli
> Assignee: Bharath Ganesh
>
> Looks like the definitionsMap in WSDLManagerImpl holds the WSDLDefinitions
> against a weak key, again relying
> on the WeakHashMap semantics for removal.
> The loadDefinition(String) method loads the WSDLDef and puts this in a map
> against a String key even if it was passed as a URL through
> getDefinition(URL).
> Like the https://issues.apache.org/jira/browse/CXF-1639 this causes a memory
> leak.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)