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 224065 - 10min - maven.nodes.DependenciesNode$DependenciesChildren.createNodeForKey
Summary: 10min - maven.nodes.DependenciesNode$DependenciesChildren.createNodeForKey
Status: RESOLVED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.3
Hardware: All All
: P3 normal (vote)
Assignee: Milos Kleint
URL:
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2012-12-20 05:11 UTC by bht
Modified: 2013-01-03 02:41 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter: 196785


Attachments
nps snapshot (1.18 MB, application/nps)
2012-12-20 05:11 UTC, bht
Details

Note You need to log in before you can comment on or make changes to this bug.
Description bht 2012-12-20 05:11:26 UTC
This issue was reported manually by jtulach.
It already has 1 duplicates 


Build: NetBeans IDE Dev (Build 201212170919)
VM: Java HotSpot(TM) Client VM, 23.5-b02, Java(TM) SE Runtime Environment, 1.7.0_09-b05
OS: Windows XP

User Comments:
bht: Creating a new empty web project



Maximum slowness yet reported was 590703 ms, average is 590703
Comment 1 bht 2012-12-20 05:11:39 UTC
Created attachment 129563 [details]
nps snapshot
Comment 2 Jaroslav Tulach 2012-12-20 05:15:11 UTC
6 minutes in one call to
org.netbeans.modules.maven.nodes.DependenciesNode$DependenciesChildren.createNodeForKey()	100.0	362,798 ms (100%)	362,659 ms	1
which then performs series of long running I/O operations:
org.openide.filesystems.FileUtil.normalizeFile()	96.53107	350,213 ms (96.5%)	350,213 ms	21
Comment 3 bht 2012-12-20 08:06:29 UTC
The context was that "Select in Projects" did not work when I edited an ant web project (in hindsight, this could have already been perfomance related). So I tried to make a test case from a fresh web project to reproduce the "Select in Projects" (which never reproduced). I cannot understand how Maven gets involved in this. Perhaps an aspect of this issue would be to avoid this connection? Perhaps some scanning started that should not have started?
Comment 4 Milos Kleint 2012-12-20 08:54:10 UTC
I'm getting a  File instance created by 3rd party code, I need to call:

FileUtil.toFileObject(FileUtil.normalizeFile(art.getFile()));

that's what's working for 99.9 % of users most of the time. The snapshot presented has multiple other threads hanging in native IO as well, and given the huge time spent, I suppose the problem is in the environment of the reporter.


I can try optimizing MavenProject.getArtifacts() by normalizing the File at the time of Mavenproject creation. For open projects that should help, for non-opened ones, the hit will be just taken elsewhere. But it's unlikely to have any real effect on performance. Additionally FileUtil.toFileObject is likely to touch FS as well, to learn if the file exists or not.
Comment 5 bht 2012-12-20 10:05:37 UTC
I find it difficult to give more info. I was working with an ant project not a Maven project. I have a few maven projects open in the projects window. But the IDE was up for a whole day so they should be quiet. Should I close all Maven projects that I am not currently using?
Comment 6 Milos Kleint 2012-12-20 10:27:53 UTC
(In reply to comment #5)
> I find it difficult to give more info. I was working with an ant project not a
> Maven project. I have a few maven projects open in the projects window. But the
> IDE was up for a whole day so they should be quiet. Should I close all Maven
> projects that I am not currently using?

select in projects will iterate all nodes (recursively) in projects view until it finds the file in question. It's unlikely that all nodes will be expanded (iterated) but a posibly significant portion can be, but there's always a part of the nodes that was previously expanded and are cached.

Closing unrelated projects will always improve performance, mostly memory wise but CPU wise as well.
Comment 7 Milos Kleint 2013-01-02 09:48:56 UTC
http://hg.netbeans.org/core-main/rev/4885bfb93787

performs the optimization mentioned in comment 4. All references to File from apache maven's MavenProject, Artifact and Model classes are normalized at the time of creation in MavenEmbedder.

I'm not convinced it will have any significant effect on Select in Projects performance though. Since we've implemented Select in Projects to work on documents from Project's dependencies, the volume of nodes to process has increased.

closing as fixed though since the DependenciesNode$DependenciesChildren.createNodeForKey() method can no longer hang in FileUtil.normalize()
Comment 8 Quality Engineering 2013-01-03 02:41:06 UTC
Integrated into 'main-golden', will be available in build *201301030001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/4885bfb93787
User: Milos Kleint <mkleint@netbeans.org>
Log: #224065 all File instances in MavenProject, Artifact and Model object trees get normalized within the MavenEmbedder codebase that created it, allows us to reduce the number of normalizing down the road. While at it also converted a few places to using FileUtilities method.