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 183972 - [69cat] AWT waiting in DefaultReplaceTokenProvider.convert() calling SourceUtils.isMainClass()
Summary: [69cat] AWT waiting in DefaultReplaceTokenProvider.convert() calling SourceUt...
Status: RESOLVED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 6.x
Hardware: All All
: P3 normal (vote)
Assignee: Antonin Nebuzelsky
URL:
Keywords: PERFORMANCE
Depends on: 191648
Blocks: 162072
  Show dependency tree
 
Reported: 2010-04-13 09:42 UTC by vdtoorn
Modified: 2011-11-10 21:44 UTC (History)
9 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 165362


Attachments
nps snapshot (21.14 KB, application/nps)
2010-04-13 09:43 UTC, vdtoorn
Details

Note You need to log in before you can comment on or make changes to this bug.
Description vdtoorn 2010-04-13 09:42:58 UTC
Build: NetBeans IDE Dev (Build 201002152000)
VM: Java HotSpot(TM) Client VM, 16.0-b13, Java(TM) SE Runtime Environment, 1.6.0_18-b07
OS: Windows 7

User Comments:
GUEST: Navigating through packages in a grails project. Netbeans suddenly froze for over a minute.

GUEST: Running windows

kawazu428: right-click on a class name in some .java file?



Maximum slowness yet reported was 97729 ms, average is 21328
Comment 1 vdtoorn 2010-04-13 09:43:02 UTC
Created attachment 97150 [details]
nps snapshot
Comment 2 Antonin Nebuzelsky 2010-11-04 16:51:15 UTC
AWT thread is blocked in a construction of a popup menu which in the case of some Maven project actions goes through

-> org.netbeans.modules.maven.ActionProviderImpl.isActionEnabled()
  -> org.netbeans.modules.maven.execute.DefaultReplaceTokenProvider.convert()
    -> org.netbeans.api.java.source.SourceUtils.isMainClass()
      -> org.netbeans.api.java.source.JavaSource.runUserActionTask()

which is called in the second part of isMainClass() method - if the class is not found in the index in the first (fast) part of this method and a parsing needs to be done to possibly find the class in non-source classpath elements. This sometimes freezes on a lock in parsing APIs if some other thread is already in there querying for something (it can be a hints computation, code-completion computation or something else).

After a discussion with Tomas I have filed an enhancement to have a version of isMainClass() which will only do the first computation step (the search in indexed sources).

DefaultReplaceTokenProvider.convert() will then be changed to call into the new version of isMainClass().
Comment 3 Antonin Nebuzelsky 2010-12-13 10:31:45 UTC
Fixed using the new method parameter introduced in issue 191648.

core-main #92c6ae689c71
Comment 4 Quality Engineering 2010-12-14 06:15:09 UTC
Integrated into 'main-golden', will be available in build *201012140001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/92c6ae689c71
User: Antonin Nebuzelsky <anebuzelsky@netbeans.org>
Log: #183972 - AWT waiting in DefaultReplaceTokenProvider.convert() calling SourceUtils.isMainClass()