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 185080 - OutOfMemoryError while working with Maven projects
Summary: OutOfMemoryError while working with Maven projects
Status: VERIFIED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 6.x
Hardware: PC Mac OS X
: P2 normal (vote)
Assignee: Antonin Nebuzelsky
URL:
Keywords: PERFORMANCE
: 176292 177625 185230 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-04-27 11:47 UTC by Petr Jiricka
Modified: 2010-07-29 14:06 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Heap dump screenshot (82.95 KB, image/png)
2010-04-27 11:47 UTC, Petr Jiricka
Details
Maven repository tree (100.79 KB, text/plain)
2010-04-28 12:07 UTC, Petr Jiricka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Jiricka 2010-04-27 11:47:02 UTC
Created attachment 98124 [details]
Heap dump screenshot

I was working with several projects:
- Maven Java EE 6 Enterprise application
- Maven Java EE 5 Web application
- NetBeans module project (Ant-based)

I was trying to deploy the Java EE 5 WebApp to WebLogic, and a OOME appeared. I have a heap dump which I can provide. After opening the heap dump and computing retained sizes, I saw the biggest objects (255 MB) were Maven-related. I am attaching the screenshot of the heap dump analyzer.
Comment 1 Petr Jiricka 2010-04-28 12:07:21 UTC
Created attachment 98199 [details]
Maven repository tree

I am attaching the contents of my Maven repository - currently it's 900 megabytes.
Comment 2 Tomas Pavek 2010-04-28 16:26:33 UTC
I opened entire GlassFish in current 6.9 dev build (JavaSE 20100427) and was happy it succeeded with default memory settings and ended with < 250MB on heap. Knowing others had problems with this I tried to invoke the indexing of maven local repository (in Options > Misc > Maven) - because it sometimes may run automatically. After it finished I had about 110MB more on heap which did not go down on GC. I have heap dumps both before/after running the indexing.
Comment 3 Petr Jiricka 2010-04-29 11:49:41 UTC
I also tried with Java SE build (actually, with full IDE ergonomics build and made sure I did not enable any other features than Java SE). Here are the exact steps:
1. Opened a couple non-Maven projects (APISupport) to warm up the Java parsing infrastructure, memory usage went up to 250 MB.
2. Created an ordinary Maven project. The IDE started to index my local repository, memory usage went up to 430 MB.
3. Did GC, memory went down to 360 MB.
4. Created heap dump, computed retained sizes. Again, org.netbeans.modules.maven.indexer.NexusRepositoryIndexerImpl#1 is taking up 257 MB.
5. After some more work in the IDE, memory suddenly went down to 140 MB.

So, not quite as bad as when I got the OutOfMemoryError, but still quite bad to have 250 MB taken up by the indexer.
Comment 4 Antonin Nebuzelsky 2010-05-04 16:32:31 UTC
Confirming the huge retained memory is caused by local maven repository indexing. My measurements have shown roughly ~25megs of heap retained after my local repository has been indexed (size of ~/.m2 is 180megs), and for pjiricka's repository which I have copied (size is 972megs) it was ~160megs retained. The heap occupation is roughly linear to the size of the repo.

One bad effect is that it occupies the memory until next full-indexing or at least index update happens, another bad effect is that if some other memory intensive task is running at the same time, it competes for heap and can end up with OOME as reported in this issue.

Making embedder and repository references in our NbIndexCreator component weak and allowing them to be collected and refreshed several times during the indexing resolves both bad effects for me. The large resulting retained heap is eliminated and the indexing also requires much less heap during its execution.  The resulting local repo index seems unaffected by this change.

http://hg.netbeans.org/core-main/rev/654dd9e01c78
Comment 5 Quality Engineering 2010-05-05 04:58:01 UTC
Integrated into 'main-golden', will be available in build *201005050200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/
User: 
Log:
Comment 6 David Simonek 2010-05-05 07:23:18 UTC
great, thanks.
Comment 7 Tomas Pavek 2010-05-10 12:55:53 UTC
Petre, can you verify that this fix helps? I think you were the only one able to reproduce memory problems with opening the GlassFish project.
Comment 8 Petr Jiricka 2010-05-11 14:13:41 UTC
Possibly this particular problem is fixed now, but after working with Maven projects for a while, I am getting other problems such as bug 185688 and bug 185847, the IDE generally feels slow and memory usage is around 400 MB, so I am not comfortable confirming that the memory usage is fixed completely/sufficiently.
Comment 9 Antonin Nebuzelsky 2010-05-11 14:23:22 UTC
> I am getting other problems such as bug 185688 and bug 185847,
> the IDE generally feels slow and memory usage is around 400 MB,
> so I am not comfortable confirming that the memory usage is fixed
> completely/sufficiently.

The bugs mentioned here are not maven related. Both are related to self-profiling feature.

Let's not mix all memory related issues into this one.

> Possibly this particular problem is fixed now

Good. Thanks for verification.
Comment 10 Jaroslav Pospisil 2010-06-23 13:21:08 UTC
v.
Comment 11 Antonin Nebuzelsky 2010-07-26 11:49:48 UTC
*** Bug 176292 has been marked as a duplicate of this bug. ***
Comment 12 Antonin Nebuzelsky 2010-07-28 09:23:40 UTC
*** Bug 177625 has been marked as a duplicate of this bug. ***
Comment 13 Antonin Nebuzelsky 2010-07-29 14:06:35 UTC
*** Bug 185230 has been marked as a duplicate of this bug. ***