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.
Build: NetBeans IDE Dev (Build 200910010513) VM: Java HotSpot(TM) 64-Bit Server VM, 11.3-b02, Java(TM) SE Runtime Environment, 1.6.0_13-b03 OS: Linux, 2.6.28-11-generic, amd64 User Comments: dheffelfinger: Importing code formatting settings from another project. GUEST: Changed include/exclude in source path GUEST: changing java platform from jdk6 to jdk5 for the webproject. Maximum slowness yet reported was 5568 ms, average is 3820
Created attachment 88786 [details] nps snapshot
This issue already has 7 duplicates see http://statistics.netbeans.org/exceptions/detail.do?id=157898
Tomas, Web and J2SE project are using the same mechanism for synchronize their implementation of Sources.getSourceGroups - project read access is requested within which dirty flag is tested. This solution has problem illustrated by this performance report: if there is somebody who holds write lock for a long time then WebSource.getSourceGroups or J2SESources.getSourceGroups are blocked. In this perf thread dump saving of projects is done in background thread which consequently blocks AWT thread. What do you think we could/should do? I'm attaching a patch which checks dirty flag before entering project mutex which could help in *some* cases.
Created attachment 88807 [details] patch idea
The patch may cause a deadlock. The problem is that the defined lock ordering is ProjectMutex, private lock. In the current impl the J2SESources even eliminates the private lock when calling getSourceGroups. In the patch the getSourceGroups is called only under the private lock which may cause reverse ordering as the getSourceGroups may acquire the ProjectMutex.
re. "In the patch the getSourceGroups is called only under the private lock which may cause reverse ordering as the getSourceGroups may acquire the ProjectMutex" - yes, but "delegate" is of type of org.netbeans.spi.project.support.ant.SourcesHelper.SourcesImpl which does not acquire ProjectMutex. Any suggestion for better fix?
Passing to Java project to resolve this issue in J2SEProject and then fix should be copied to Web project.
jet-main cde4c8416b1c
Ported to web/j2ee projects as e5acb588e4c9
Tomas, your caching is broken as it is not taking into account type. I fixed it for web/j2ee projects in web-main in 1b433a12c65d by turning cachedGroups into Map<String, SourceGroup[]>. Please review. I would fix it in J2SE as well but I do not have your change yet.
Thanks David, I will port the fix into j2seproject. Sorry I've forgot about the types of source groups.
Fixed in jet-main: f2e2019cac48