cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Giovanni Borelli (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CXF-6632) Memory leak due to literal keys in WSDLDefinition map
Date Sat, 10 Oct 2015 06:30:05 GMT

    [ https://issues.apache.org/jira/browse/CXF-6632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14951644#comment-14951644
] 

Giovanni Borelli edited comment on CXF-6632 at 10/10/15 6:29 AM:
-----------------------------------------------------------------

I can confirm your test cases result: no memory leak there.

Just to add some more real world complexity I created a simple servlet (running on a different
JVM) that streams local file content to requestor, and I used it in your test case instead
of reading WSDL from fs:

{code:java}
...
        List<URL> urls = new ArrayList<URL>(max); 
        for (int x = 0; x < max; x++) {
            File f = FileUtils.createTempFile("memtest", ".wsdl", FileUtils.createTmpDir(),
true);
            FileOutputStream fout = new FileOutputStream(f);
            fout.write(wsdl);
            fout.close();
            urls.add(new URL("http://localhost:8080/testweb/GetFile?path="+f.getAbsolutePath()));
        }
...
{code}

this is my result:

{code}
Total used: 165609968
Total used: 303695992
Total used: 444959136
Total used: 586214952
Total used: 730550224
Total used: 869786704
Total used: 1012532344
Total used: 1151427424
Total used: 1292696288
Total used: 1433952648
Total used: 1575213840
Total used: 1719920184
Total used: 1857696448
Total used: 2002497848
Total used: 2140335368
Total used: 2285109960
Total used: 2426403888
Total used: 2564113000
Total used: 2708663696
Total used: 2846651736
{code}

the leak: WSDLDefinition map guilty again.

Using my p.o.c. "fix":
{code}
Total used: 20945352
Total used: 20971648
Total used: 20962768
Total used: 20977368
Total used: 20977832
Total used: 20964664
Total used: 20966448
Total used: 20961080
Total used: 21549656
Total used: 21537400
Total used: 21543616
Total used: 21529872
Total used: 21551968
Total used: 21546600
Total used: 21541760
Total used: 21544120
Total used: 21544112
Total used: 21551776
Total used: 21534288
Total used: 21543784
{code}

no leak.



was (Author: gio):
I can confirm your test cases result: no memory leak there.

Just to add some more real world complexity I created a simple servlet (running on a different
JVM) that streams local file content to requestor, and I used it in your test case instead
of reading WSDL from fs:

{code:java}
...
        List<URL> urls = new ArrayList<URL>(max); 
        for (int x = 0; x < max; x++) {
            File f = FileUtils.createTempFile("memtest", ".wsdl", FileUtils.createTmpDir(),
true);
            FileOutputStream fout = new FileOutputStream(f);
            fout.write(wsdl);
            fout.close();
            urls.add(new URL("http://localhost:8080/testweb/GetFile?path="+f.getAbsolutePath()));
        }
...
{code}

this is my result:

{code}
Total used: 165609968
Total used: 303695992
Total used: 444959136
Total used: 586214952
Total used: 730550224
Total used: 869786704
Total used: 1012532344
Total used: 1151427424
Total used: 1292696288
Total used: 1433952648
Total used: 1575213840
Total used: 1719920184
Total used: 1857696448
Total used: 2002497848
Total used: 2140335368
Total used: 2285109960
Total used: 2426403888
Total used: 2564113000
Total used: 2708663696
Total used: 2846651736
{code}

the leak, again.

Using my p.o.c. "fix":
{code}
Total used: 20945352
Total used: 20971648
Total used: 20962768
Total used: 20977368
Total used: 20977832
Total used: 20964664
Total used: 20966448
Total used: 20961080
Total used: 21549656
Total used: 21537400
Total used: 21543616
Total used: 21529872
Total used: 21551968
Total used: 21546600
Total used: 21541760
Total used: 21544120
Total used: 21544112
Total used: 21551776
Total used: 21534288
Total used: 21543784
{code}

no leak: WSDLDefinition map guilty.


> 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)

Mime
View raw message