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 173684 - [68cat] AWT thread blocked for 3569 ms.
Summary: [68cat] AWT thread blocked for 3569 ms.
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Tomas Zezula
URL: http://statistics.netbeans.org/except...
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2009-10-03 15:37 UTC by dheffelfinger
Modified: 2009-11-11 05:36 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 157898


Attachments
nps snapshot (27.51 KB, bin/nps)
2009-10-03 15:37 UTC, dheffelfinger
Details
patch idea (741 bytes, patch)
2009-10-04 23:04 UTC, David Konecny
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description dheffelfinger 2009-10-03 15:37:07 UTC
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
Comment 1 dheffelfinger 2009-10-03 15:37:14 UTC
Created attachment 88786 [details]
nps snapshot
Comment 2 Exceptions Reporter 2009-10-03 15:37:19 UTC
This issue already has 7 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=157898
Comment 3 David Konecny 2009-10-04 23:04:05 UTC
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.
Comment 4 David Konecny 2009-10-04 23:04:52 UTC
Created attachment 88807 [details]
patch idea
Comment 5 Tomas Zezula 2009-10-05 10:53:17 UTC
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.

Comment 6 David Konecny 2009-10-05 21:46:32 UTC
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?
Comment 7 David Konecny 2009-11-04 22:30:32 UTC
Passing to Java project to resolve this issue in J2SEProject and then fix should be copied to Web project.
Comment 8 Tomas Zezula 2009-11-10 08:15:35 UTC
jet-main cde4c8416b1c
Comment 9 David Konecny 2009-11-10 16:13:32 UTC
Ported to web/j2ee projects as e5acb588e4c9
Comment 10 David Konecny 2009-11-10 19:58:31 UTC
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.
Comment 11 Tomas Zezula 2009-11-11 01:47:51 UTC
Thanks David, I will port the fix into j2seproject.
Sorry I've forgot about the types of source groups.
Comment 12 Tomas Zezula 2009-11-11 05:36:43 UTC
Fixed in jet-main: f2e2019cac48