This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 215847 - Severe memory leak in gsf.testrunner
Summary: Severe memory leak in gsf.testrunner
Status: VERIFIED FIXED
Alias: None
Product: utilities
Classification: Unclassified
Component: Test Runner (show other bugs)
Version: 7.2
Hardware: All All
: P1 normal (vote)
Assignee: Jiri Rechtacek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-23 21:22 UTC by Petr Hejl
Modified: 2012-09-01 11:07 UTC (History)
7 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
possible fix (5.85 KB, patch)
2012-07-23 21:48 UTC, Petr Hejl
Details | Diff
simplified patch (6.38 KB, patch)
2012-07-24 11:08 UTC, Petr Hejl
Details | Diff
final patch (5.93 KB, patch)
2012-07-25 10:03 UTC, Theofanis Oikonomou
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Hejl 2012-07-23 21:22:38 UTC
With every (JUnit for me) test action the memory consumption is growing. The amount of memory depends on the amount of output the test generates. I can even reproduce OOME (heap size approx. 750M) with less then 10 test runs with a single test.

The cause is imo InputOutput component is never GCed.

There seems to be two reasons. The first one is the value in WeakHashMap in org.netbeans.modules.gsf.testrunner.api.Manager.displayHandlers references the key so it is never GCed. The second one is the core.output2 infrastructure holds InputOutput until the closeInputOutput is called but gsf.testrunner never does that.
Comment 1 Petr Hejl 2012-07-23 21:48:30 UTC
Created attachment 122277 [details]
possible fix

This patch seems to be working - resolving both issues. OTOH I'm not an expert in gsf.testrunner.

I think I could provide a better patch at cost of changing gsf.testrunner friend api. I'll try that tomorrow.
Comment 2 Petr Hejl 2012-07-23 21:51:15 UTC
BTW Jardo, is it ok that io infrastructure holds strong reference of io created for custom container?
Comment 3 Petr Hejl 2012-07-24 11:08:33 UTC
Created attachment 122292 [details]
simplified patch

I originally thought this would be api change, but the ResultWindow is package private. So this is simplified patch without any api change.
Comment 4 Jaroslav Havlin 2012-07-24 14:30:56 UTC
(In reply to comment #2)
> BTW Jardo, is it ok that io infrastructure holds strong reference of io created
> for custom container?
It is not ideal, but it works correctly if clients close all created IO objects. It may be improved in the future. For now adding a note to JavaDoc:
http://hg.netbeans.org/core-main/rev/871ef973c899
Comment 5 Petr Hejl 2012-07-24 15:14:28 UTC
Theofanis, I can integrate the patch for you. Let me know whether I should do that.
Comment 6 Theofanis Oikonomou 2012-07-24 16:22:58 UTC
Petr, thank you for the patch. Seems fine to me. I will go ahead and integrate it tomorrow.
Comment 7 Theofanis Oikonomou 2012-07-25 10:03:53 UTC
Created attachment 122347 [details]
final patch

I am attaching the patch I am going to integrate. I think there is no need to increase the spec version. Also, I am reverting the conversion of ResultWindow.addDisplayComponent from public to package private. Was there a reason for that? If there are no objections I will integrate later today. Thank you
Comment 8 Petr Hejl 2012-07-25 11:05:12 UTC
(In reply to comment #7)
> Created attachment 122347 [details]
> final patch
> 
> I am attaching the patch I am going to integrate. I think there is no need to
> increase the spec version. Also, I am reverting the conversion of
> ResultWindow.addDisplayComponent from public to package private. Was there a
> reason for that?
No particular reason. I thought ResultWindow was an api, but it is not.

> If there are no objections I will integrate later today. Thank
> you
Ok.
Comment 9 Theofanis Oikonomou 2012-07-25 11:12:46 UTC
Integrated into core-main: http://hg.netbeans.org/core-main/rev/50141649f597
Comment 10 Quality Engineering 2012-07-26 02:20:00 UTC
Integrated into 'main-golden', will be available in build *201207260002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/871ef973c899
User: Jaroslav Havlin <jhavlin@netbeans.org>
Log: #215847: JavaDoc - Inform users that InputOutput objects should be explicitly closed when using custom IOContainer
Comment 11 Tomas Mysik 2012-07-26 03:34:35 UTC
Mariáne, this is a patch candidate, right?
Comment 12 Marian Mirilovic 2012-07-26 06:48:21 UTC
sure ... integrate into release72 branch once verified in trunk, see http://wiki.netbeans.org/NetBeansPatchesProcess
Comment 13 Petr Cyhelsky 2012-08-29 15:21:50 UTC
verified in trunk, please proceed with transplant
Comment 14 Jiri Rechtacek 2012-08-30 12:19:38 UTC
transplanted to release72 - http://hg.netbeans.org/releases/rev/41472194bf52
Comment 15 Quality Engineering 2012-09-01 11:07:57 UTC
Integrated into 'releases', will be available in build *201209010822* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/41472194bf52
User: Theofanis Oikonomou <theofanis@netbeans.org>
Log: Issue #215847 - Severe memory leak in gsf.testrunner
(transplanted from 50141649f597d7bb88427f6e6801f86e00c73d23)