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 172209 - 8s or 20s in EditorContextImpl.getCurrentElement
Summary: 8s or 20s in EditorContextImpl.getCurrentElement
Status: RESOLVED WONTFIX
Alias: None
Product: apisupport
Classification: Unclassified
Component: Project (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Jesse Glick
URL: http://statistics.netbeans.org/except...
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2009-09-14 17:30 UTC by Filip Zamboj
Modified: 2010-03-11 12:39 UTC (History)
11 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 158472


Attachments
nps snapshot (38.62 KB, bin/nps)
2009-09-14 17:30 UTC, Filip Zamboj
Details
nps snapshot (35.88 KB, bin/nps)
2009-09-28 21:30 UTC, Jesse Glick
Details
nps snapshot (256.00 KB, application/nps)
2009-11-12 11:22 UTC, Exceptions Reporter
Details
nps snapshot (256.00 KB, application/nps)
2009-12-15 08:51 UTC, Exceptions Reporter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Filip Zamboj 2009-09-14 17:30:48 UTC
Build: NetBeans IDE Dev (Build 200909010201)
VM: Java HotSpot(TM) 64-Bit Server VM, 14.2-b01, Java(TM) SE Runtime Environment, 1.6.0_16-b01
OS: Linux, 2.6.28-15-generic, amd64

User Comments:
fzamboj: I disabled breakpoint on method start and right away enabled a breakpoint on code in that method. All was done by toggling the bar with line numbers not in breakpoint view.


Maximum slowness yet reported was 20825 ms, average is 20825
Comment 1 Filip Zamboj 2009-09-14 17:30:53 UTC
Created attachment 87633 [details]
nps snapshot
Comment 2 Martin Entlicher 2009-09-14 17:41:48 UTC
This is because parsing is called from AWT. It's also illustrated by following warnings printed into messages.log:

WARNING [org.netbeans.modules.parsing.impl.TaskProcessor]: ParserManager.parse called in AWT event thread by:
org.netbeans.modules.debugger.jpda.projects.EditorContextImpl.getCurrentElement(EditorContextImpl.java:1782)
WARNING [org.netbeans.modules.parsing.impl.TaskProcessor]: ParserManager.parse called in AWT event thread by:
org.netbeans.modules.debugger.jpda.projects.EditorContextImpl.getCurrentMethodDeclaration(EditorContextImpl.java:911)
Comment 3 Jesse Glick 2009-09-28 21:30:32 UTC
Build: NetBeans IDE Dev (Build 090928)
VM: Java HotSpot(TM) Client VM, 14.1-b02, Java(TM) SE Runtime Environment, 1.6.0_15-b03
OS: Linux, 2.6.28-15-generic, i386

User Comments: 
Trying to remove a breakpoint by clicking on its icon.
Maximum slowness yet reported was 45086 ms, average is 32955
Comment 4 Jesse Glick 2009-09-28 21:30:36 UTC
Created attachment 88455 [details]
nps snapshot
Comment 5 Martin Entlicher 2009-09-29 14:54:12 UTC
Time (CPU) shows 14.3ms, which is O.K. for AWT.
There is absolutely no reason for ReentrantLock.tryLock() to take 20 seconds.
The code should behave fine when called from AWT.
Comment 6 Jaroslav Tulach 2009-10-30 09:24:26 UTC
I've just seen: http://statistics.netbeans.org/exceptions/exception.do?id=290654 - 8s is way too much to 
justify "wontfix" I guess.
Comment 7 Martin Entlicher 2009-11-04 14:41:15 UTC
?? 8s ?
Time (CPU) for AWT thread is 234ms.

Resolving back as WONTFIX.
Comment 8 Jesse Glick 2009-11-04 15:42:11 UTC
The CPU time is small because the thread is blocked waiting for something else. (In my snapshot the CPU is being
consumed ultimately by the project system finding classpaths, inside the JPDAReload Ant task.)

The problem is calling JavaSource.runWhenScanFinished, a potentially blocking method, from EQ. Probably
ToggleMethodFieldBreakpointAction.submitFieldOrMethodBreakpoint should run asynch, or at least use the new
ProgressUtils.runOffEventDispatchThread.
Comment 9 Martin Entlicher 2009-11-09 10:22:05 UTC
1) There is no reason why java.util.concurrent.locks.ReentrantLock.tryLock() would sit there for 45 seconds! This method should return immediately. In this case it looks like tryLock(100, TimeUnit.MILLISECONDS) is called, but this still does not justify the 45 seconds!  Because of that I considered the dump to be broken.

2) JavaSource.runWhenScanFinished() returns Future. Therefore I do not think it should be blocking anything.

Therefore moving to Java, I do not think I can do anything with these items.
Comment 10 Jan Lahoda 2009-11-11 02:29:16 UTC
I see two issues here:
-debugger calls runWhenScanFinished, which, in case no scan is running, blocks (behaves the same as runUserActionTask).
-some queries are very, very slow in the IDE. For example, in Jesse's dump, apisupport.project.queries.ClassPathProviderImpl.findClassPath takes more than 41s! In Filip's snapshot the UpdateTrackingFileOwnerQuery.getOwner takes more than 12 seconds! So when the user does an action, the action will take at least 41s/12s to complete. Even if there would be a progress, the user wants the action to be done, not to look at the progress. What is the inevitable reason why apisupport.project has to be so incredibly slow?
Comment 11 Tomas Zezula 2009-11-11 07:01:21 UTC
The problem is in the debugger calling java parser in the AWT thread. The JS.runWhenScanFinished javadoc says:
<cite>
Performs the given task when the scan finished. When no background scan is running it performs the given task synchronously. When the background scan is active it queues the given task and returns, the task is performed when the background scan completes by the thread doing the background scan.
</cite>
When no background scan is active it behaves in the same way as the JS.runUserActionTask. When there is already a user action task running it blocks until it is done and that this task is executed.
The user action tasks are rather fast, the problem in this case is that the active user task ended in the slow apisupport project.
Comment 12 Martin Entlicher 2009-11-11 10:48:30 UTC
After discussion with Tomas,moving to apisupport. User action tasks should be rather fast, but tasks in apisupport are quite slow and all other tasks must wait for them....
Comment 13 Exceptions Reporter 2009-11-12 11:22:16 UTC
Build: NetBeans IDE 6.8 Beta (Build 200910212001)
VM: Java HotSpot(TM) Client VM, 14.2-b01, Java(TM) SE Runtime Environment, 1.6.0_16-b01
OS: Linux, 2.6.27-9-generic, i386

User Comments: 
Code Sense drop down
Maximum slowness yet reported was 53047 ms, average is 17359
Comment 14 Exceptions Reporter 2009-11-12 11:22:23 UTC
Created attachment 90936 [details]
nps snapshot
Comment 15 Exceptions Reporter 2009-11-12 11:22:30 UTC
This issue already has 12 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=158472
Comment 16 Jesse Glick 2009-11-13 09:28:31 UTC
Probably a dupe of the issue to rewrite module scanning to be fully incremental.
Comment 17 Exceptions Reporter 2009-12-15 08:51:20 UTC
Created attachment 92613 [details]
nps snapshot

I copied same code from old class to new one.
Comment 18 Jesse Glick 2010-03-11 12:39:55 UTC
Not clear what the common issue in these snapshots is, or what the slow "tasks" in apisupport are. Bug #173109 made module list loading a lot faster, but I don't see that being invoked.