cornercorner
FeaturesPluginsDocs & SupportCommunityPartners

Bug 168874 - Delay writing of Nb platform to global properties
: Delay writing of Nb platform to global properties
Status: RESOLVED FIXED
: apisupport
Project
: 6.8
: All All
: P3 (vote)
: 6.8
Assigned To:
:
:
:
: PERFORMANCE
:
:
  Show dependency treegraph
 
Reported: 2009-07-21 12:04 by
Modified: 2009-07-24 17:42 (History)
Issue Type: DEFECT
:


Attachments
Suggested fix (3.62 KB, patch)
2009-07-21 12:12, Jaroslav Tulach
Details | Diff
Corrected patch without System.err (1.57 KB, patch)
2009-07-22 09:44, Jaroslav Tulach
Details | Diff


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2009-07-21 12:04:24
Our ReadAccessTest 
http://ruhudson4qe.russia.sun.com/view/Performance/job/Perf_(ide.ergonomics_ide.kit_java.kit_performance)/label=Perf-WinXP-xp1-stable/lastBuild/testReport/org.netbeans.test.ide/ReadAccessTest/testReadAccess/
seems to be failing due to some code executed by apisupport during start.
Touching JAR files slows down the start 
(especially on cold disk) and we'd like to prevent it.

Can this code be delayed until apisupport module is really used (a project is
loaded, an action is called, etc.)?

This is the action storm triggered by API Support:

java.lang.Exception: checkRead: E:\space\hudson\ergonomics\nbbuild\nbantext.jar

org.netbeans.test.ide.CountingSecurityManager.checkRead(CountingSecurityManager.java:199)
 java.io.File.isDirectory(File.java:752)

org.netbeans.modules.masterfs.filebasedfs.naming.NamingFactory.createFileNaming(NamingFactory.java:275)

org.netbeans.modules.masterfs.filebasedfs.naming.NamingFactory.registerInstanceOfFileNaming(NamingFactory.java:190)

org.netbeans.modules.masterfs.filebasedfs.naming.NamingFactory.registerInstanceOfFileNaming(NamingFactory.java:175)

org.netbeans.modules.masterfs.filebasedfs.naming.NamingFactory.fromFile(NamingFactory.java:86)

org.netbeans.modules.masterfs.filebasedfs.children.ChildrenSupport.rescanChildren(ChildrenSupport.java:207)

org.netbeans.modules.masterfs.filebasedfs.children.ChildrenSupport.getChildren(ChildrenSupport.java:75)

org.netbeans.modules.masterfs.filebasedfs.fileobjects.FolderObj$FolderChildrenCache.getChildren(FolderObj.java:516)

org.netbeans.modules.masterfs.filebasedfs.fileobjects.FolderObj.getChildren(FolderObj.java:131)
 org.openide.filesystems.FileUtil$Holder.locateCurrent(FileUtil.java:312)
 org.openide.filesystems.FileUtil$Holder.<init>(FileUtil.java:287)
 org.openide.filesystems.FileUtil.addFileChangeListener(FileUtil.java:244)

org.netbeans.spi.project.support.ant.PropertyUtils$FilePropertyProvider.<init>(PropertyUtils.java:254)

org.netbeans.spi.project.support.ant.PropertyUtils.propertiesFilePropertyProvider(PropertyUtils.java:237)

org.netbeans.modules.apisupport.project.Evaluator.createEvaluator(Evaluator.java:360)
 org.netbeans.modules.apisupport.project.Evaluator.<init>(Evaluator.java:145)

org.netbeans.modules.apisupport.project.NbModuleProject.<init>(NbModuleProject.java:174)
 java.lang.reflect.Constructor.newInstance(Constructor.java:513)

org.netbeans.modules.project.ant.AntBasedGenericType.createProject(AntBasedGenericType.java:122)

org.netbeans.modules.project.ant.AntBasedProjectFactorySingleton.loadProject(AntBasedProjectFactorySingleton.java:249)
 org.netbeans.api.project.ProjectManager.createProject(ProjectManager.java:354)
 org.netbeans.api.project.ProjectManager.access$300(ProjectManager.java:80)
 org.netbeans.api.project.ProjectManager$2.run(ProjectManager.java:275)
 org.netbeans.api.project.ProjectManager$2.run(ProjectManager.java:227)
 org.openide.util.Mutex.readAccess(Mutex.java:327)
 org.netbeans.api.project.ProjectManager.findProject(ProjectManager.java:227)

org.netbeans.modules.projectapi.SimpleFileOwnerQueryImplementation.getOwner(129)
 org.netbeans.api.project.FileOwnerQuery.getOwner(FileOwnerQuery.java:101)

org.netbeans.modules.php.project.util.PhpProjectUtils.getPhpProject(PhpProjectUtils.java:99)

org.netbeans.modules.php.project.PhpVisibilityQuery.isVisible(PhpVisibilityQuery.java:67)
 org.netbeans.api.queries.VisibilityQuery.isVisible(VisibilityQuery.java:99)

org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.fileChanged(RepositoryUpdater.java:401)

org.openide.filesystems.FCLSupport$DispatchEventWrapper.dispatchEventImpl(FCLSupport.java:136)

org.openide.filesystems.FCLSupport$DispatchEventWrapper.dispatchEvent(FCLSupport.java:122)
 org.openide.filesystems.FCLSupport.dispatchEvent(FCLSupport.java:99)
 org.openide.filesystems.FileObject$ED.dispatch(FileObject.java:1052)
 org.openide.filesystems.FileSystem$EventDispatcher.run(FileSystem.java:925)
 org.openide.filesystems.EventControl.dispatchEvent(EventControl.java:77)
 org.openide.filesystems.FileSystem.dispatchEvent(FileSystem.java:544)
 org.openide.filesystems.FileObject.dispatchEvent(FileObject.java:469)
 org.openide.filesystems.FileObject.fireFileChangedEvent(FileObject.java:437)

org.netbeans.modules.masterfs.filebasedfs.fileobjects.BaseFileObj.fireFileChangedEvent(BaseFileObj.java:509)

org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObj$1.close(FileObj.java:116)

org.netbeans.spi.project.support.ant.PropertyUtils$2.run(PropertyUtils.java:186)

org.netbeans.spi.project.support.ant.PropertyUtils$2.run(PropertyUtils.java:156)
 org.openide.util.Mutex.writeAccess(Mutex.java:433)

org.netbeans.spi.project.support.ant.PropertyUtils.putGlobalProperties(PropertyUtils.java:156)
 org.netbeans.modules.apisupport.project.Install$1.run(Install.java:72)
 org.netbeans.modules.apisupport.project.Install$1.run(Install.java:63)
 org.openide.util.Mutex.writeAccess(Mutex.java:394)
 org.netbeans.modules.apisupport.project.Install.restored(Install.java:63)
 org.netbeans.core.startup.NbInstaller.loadCode(NbInstaller.java:440)
 org.netbeans.core.startup.NbInstaller.load(NbInstaller.java:361)
 org.netbeans.ModuleManager.enable(ModuleManager.java:917)
 org.netbeans.core.startup.ModuleList.installNew(ModuleList.java:289)
 org.netbeans.core.startup.ModuleList.trigger(ModuleList.java:225)
 org.netbeans.core.startup.ModuleSystem.restore(ModuleSystem.java:276)
 org.netbeans.core.startup.Main.getModuleSystem(Main.java:168)
 org.netbeans.core.startup.Main.start(Main.java:309)
 org.netbeans.core.startup.TopThreadGroup.run(TopThreadGroup.java:111)
 java.lang.Thread.run(Thread.java:619)
------- Comment #1 From 2009-07-21 12:12:09 -------
Created an attachment (id=84996) [details]
Suggested fix
------- Comment #2 From 2009-07-21 13:13:43 -------
1) Test setup is the culprit here, this doesn't happen to real user. Tested IDE
has userdir somewhere under test work
dir, thus it is owned by NB.org module project, which then gets (IMHO
needlessly) loaded by PHP project support.

2) I'm not 100% sure that the stored property is actually not needed before
NbPlatform is loaded (although you are
probably right), and I don't have time to investigate it. Given 1) I'd suggest
to fix test setup instead or WONTFIX.
------- Comment #3 From 2009-07-22 09:39:07 -------
You are right the test setup influences the fact that the NbModuleProject is
created. This would not happen in real 
user scenario. On the other hand, this issue claims that API Support writes
down the global properties file 
prematurely, which is true even in the user scenario. We don't want users to
pay price for feature they don't use, 
thus the report remains valid.

Obviously I cannot confirm that NbPlatform is loaded everytime the property
would be needed. Although I can guarantee 
that the class is loaded as soon as NbModuleProject or NbSuiteProject is
opened. It is obviously up to you to decide 
whether you want to leave this bug open or apply the patch as soon as possible
(so potential problems are revealed 
soon before release).

I will investigate the issue with PHP visibility query and think about ways to
improve the test (though I do not have 
any reasonable idea right now).
------- Comment #4 From 2009-07-22 09:44:44 -------
Created an attachment (id=85052) [details]
Corrected patch without System.err
------- Comment #5 From 2009-07-22 16:54:44 -------
The patch looks reasonable to me (though Install.java should just be deleted
altogether). Should defer writing the NB
platform unless and until someone actually works with an NBM project.
------- Comment #6 From 2009-07-23 12:40:45 -------
core-main#c759aee432d6
------- Comment #7 From 2009-07-24 17:42:45 -------
Integrated into 'main-golden', will be available in build *200907241401* on
http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/c759aee432d6
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #168874: Don't initialize apisupport prematuraly - wait until someone
really uses it, e.g. loads NbPlatform class. Approved by Jesse and Richard.