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 216001 - 160M in org.netbeans.modules.maven.api.NbMavenProject#1
Summary: 160M in org.netbeans.modules.maven.api.NbMavenProject#1
Status: RESOLVED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.4
Hardware: PC All
: P1 normal with 1 vote (vote)
Assignee: Milos Kleint
URL:
Keywords:
: 243167 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-07-26 11:50 UTC by FiruzzZ
Modified: 2014-03-28 10:26 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
messages.log from nb/var/log/ (41.85 KB, application/octet-stream)
2012-07-26 12:59 UTC, FiruzzZ
Details
messages.log (23.68 KB, text/x-log)
2014-01-18 09:04 UTC, lucrus
Details
messages.log from my user dir (230.89 KB, text/x-log)
2014-01-18 09:21 UTC, lucrus
Details

Note You need to log in before you can comment on or make changes to this bug.
Description FiruzzZ 2012-07-26 11:50:47 UTC
Every time the memory monitor indicate values higher than 300/400MB the error message appear.
I got 4Gb RAM, and always more than 2Gb are free.
Comment 1 Petr Cyhelsky 2012-07-26 12:24:47 UTC
The important thing is the Xmx setting (as indicated at the website linked from the message), not the overall PC memory size - JVM can only use the memory which is allocated to it. Please attach your messages.log file, so that we can see your Xmx setting from it.
Comment 2 FiruzzZ 2012-07-26 12:59:50 UTC
Created attachment 122403 [details]
messages.log  from nb/var/log/
Comment 3 Petr Cyhelsky 2013-04-02 09:27:22 UTC
The messages.log is worthless, because it ends even before system information is displayed - it seems it is from the run which ended too early. Can you please attach another one?
Comment 4 lucrus 2014-01-18 08:58:41 UTC
Same error here, I have 16GB ram which means the default Xmx is more than 3GB (I did not change the default).
I've changed hardware field to PC/all os because FiruzzZ uses Windows while I use Linux, so I assume it's a cross platform bug.
I'm uploading the heap dump, it will take a while.
Comment 5 lucrus 2014-01-18 09:04:04 UTC
Created attachment 144096 [details]
messages.log
Comment 6 lucrus 2014-01-18 09:08:09 UTC
Attached my message log because so the page [1] says, but I'm afraid mine is worthless just like the previous...

[1] http://wiki.netbeans.org/InsufficientMemoryToIndexRoot
Comment 7 lucrus 2014-01-18 09:16:03 UTC
Please ignore my messages.log, I've just realized it's not even the current one but it's a 3 months old one, I don't even know where NB is writing it these days...
Comment 8 lucrus 2014-01-18 09:21:54 UTC
Created attachment 144097 [details]
messages.log from my user dir

I've finally found the correct message log (in my user dir, not the one in the NB install dir), hope that helps.
Comment 9 lucrus 2014-01-18 10:15:29 UTC
Sorry but uploading zipped heap dump of about 200MB is nearly impossible with my internet connection, the upload breaks much earlier (no QoS on my router).
I try uploading it to a server I manage (with scp -l), then I send the link here.
Comment 10 lucrus 2014-01-18 13:48:51 UTC
Here is the heap dump:
http://www.sulweb.org/download/sparsi/heapdump.zip
Comment 11 Tomas Hurka 2014-01-21 08:46:38 UTC
According to the heap dump org.netbeans.modules.maven.api.NbMavenProject#1 has retained size around 160M. NbMavenProject.files field contains array of 500K instances of java.io.File. It looks like there is a lot of duplicate java.io.File instances. Reassigning to Projects/Maven for further investigation.
Comment 12 Tomas Hurka 2014-01-21 13:32:47 UTC
Separate issue #240768 was filed for debugger problem.
Comment 13 Milos Kleint 2014-01-21 13:49:45 UTC
on each project reload (either explicit by user or implicit after a build) the files list was readded entries for (generated) source roots. all the way up to 150M it appears.

The partly obsolete concept/api of NbMavenproject.addWatchedPath is responsible. I've attempted to get rid of it with changeset [1] but didn't manage all the way for time and risk reasons.

The *fix* is to stop adding indefinitely but only keep each file only once. That's a bit controversial as it changes behaviour of removeWatchedPath(). Previously the listener was only removed if all occurences were removed from the list, now the first removal removes the listener as well. I've double checked all known codebase and afaik there's little code calling removeWatchedPath() in the first place and if it's there, it's not clashing with other usecases (so the paths should be different)

The ideal fix would be getting rid of the watchedPath paradigm altogether and migrate all usages to private listeners via FileUtil.addfileChangeListener(). However with the currently remaining cases, it's risky rewrite.

leak fix/workaround: http://hg.netbeans.org/core-main/rev/cfe8456058ff


[1] http://hg.netbeans.org/core-main/rev/fcbc8f7ff00f
Comment 14 Quality Engineering 2014-01-23 02:41:04 UTC
Integrated into 'main-silver', will be available in build *201401230001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/cfe8456058ff
User: Milos Kleint <mkleint@netbeans.org>
Log: #216001 memory leak of endlessly accumulating watched paths patched
Comment 15 Jaroslav Havlin 2014-03-28 10:26:57 UTC
*** Bug 243167 has been marked as a duplicate of this bug. ***