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 202490 - LowPerformance took 51850 ms.
Summary: LowPerformance took 51850 ms.
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Parsing & Indexing (show other bugs)
Version: 7.1
Hardware: All All
: P2 normal (vote)
Assignee: Tomas Zezula
URL:
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2011-09-22 12:04 UTC by Vladimir Voskresensky
Modified: 2011-10-05 14:13 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 181301


Attachments
nps snapshot (49.18 KB, application/nps)
2011-09-22 12:04 UTC, Vladimir Voskresensky
Details
IDE hangs on typing for minute (29.43 KB, text/plain)
2011-09-22 12:14 UTC, Vladimir Voskresensky
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Voskresensky 2011-09-22 12:04:39 UTC
This bug was originally marked as duplicate of bug 189979, that is already resolved. This bug is still valid, so this seems to be another bug, but it might be related.

Build: NetBeans IDE Dev (Build 20110920-bb06b4016af1)
VM: Java HotSpot(TM) Client VM, 14.0-b16, Java(TM) SE Runtime Environment, 1.6.0_14-b08
OS: SunOS

User Comments:
vv159170: typing during "Checking for external changes" is hang for ~1 minute!

vv159170: typing during Check for external changes activity is impossible...



Maximum slowness yet reported was 51850 ms, average is 49563
Comment 1 Vladimir Voskresensky 2011-09-22 12:04:45 UTC
Created attachment 111030 [details]
nps snapshot
Comment 2 Vladimir Voskresensky 2011-09-22 12:12:06 UTC
Tomas, please, have a look. 
IDE is completely unusable if "Checking for external changes" in progress
Product Version: NetBeans IDE Dev (Build 20110920-bb06b4016af1)
Java: 1.6.0_14; Java HotSpot(TM) Client VM 14.0-b16
System: SunOS version 5.10 running on x86; UTF-8; ru_RU (nb)
User directory: /export/home/vv159170/.netbeans/dev
Cache directory: /export/home/vv159170/.netbeans/dev/var/cache

"AWT-EventQueue-1" prio=3 tid=0x08ae5000 nid=0x21 waiting for monitor entry [0x749fe000]
   java.lang.Thread.State: BLOCKED (on object monitor)
        at org.netbeans.modules.masterfs.filebasedfs.naming.NamingFactory.fromFile(NamingFactory.java:64)
        - waiting to lock <0xddfac250> (a java.lang.Class for org.netbeans.modules.masterfs.filebasedfs.naming.NamingFactory)
        at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObjectFactory.create(FileObjectFactory.java:418)
        at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObjectFactory.getOrCreate(FileObjectFactory.java:401)
        - locked <0x83dadeb8> (a java.util.Collections$SynchronizedMap)
        at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObjectFactory.issueIfExist(FileObjectFactory.java:373)
        at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObjectFactory.getFileObject(FileObjectFactory.java:196)
        at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObjectFactory.getValidFileObject(FileObjectFactory.java:698)
        at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FolderObj.getFileObject(FolderObj.java:125)
        at org.openide.filesystems.FileUtil.createFolder(FileUtil.java:860)
        at org.netbeans.modules.parsing.spi.indexing.Context.<init>(Context.java:100)
        at org.netbeans.modules.parsing.spi.indexing.Indexable$MyAccessor.createContext(Indexable.java:163)
        at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.handleDocumentModification(RepositoryUpdater.java:1012)
        at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.atomicUnlock(RepositoryUpdater.java:880)
        at org.netbeans.editor.BaseDocument.fireAtomicUnlock(BaseDocument.java:1929)
        at org.netbeans.editor.BaseDocument.atomicUnlockImpl(BaseDocument.java:1801)
        - locked <0x89d0a2d8> (a org.netbeans.modules.editor.NbEditorDocument)
        at org.netbeans.editor.BaseDocument.atomicUnlockImpl(BaseDocument.java:1786)
        at org.netbeans.editor.GuardedDocument.runAtomicAsUser(GuardedDocument.java:353)
        at org.netbeans.editor.BaseKit$InsertBreakAction.actionPerformed(BaseKit.java:1336)
        at org.netbeans.modules.editor.java.JavaKit$JavaInsertBreakAction.actionPerformed(JavaKit.java:528)
        at org.netbeans.editor.BaseAction.actionPerformed(BaseAction.java:339)
        at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1636)
        at javax.swing.JComponent.processKeyBinding(JComponent.java:2851)
        at javax.swing.JComponent.processKeyBindings(JComponent.java:2886)
        at javax.swing.JComponent.processKeyEvent(JComponent.java:2814)
        at java.awt.Component.processEvent(Component.java:6040)
        at java.awt.Container.processEvent(Container.java:2041)
        at java.awt.Component.dispatchEventImpl(Component.java:4630)
        at java.awt.Container.dispatchEventImpl(Container.java:2099)
        at java.awt.Component.dispatchEvent(Component.java:4460)
        at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1848)
        at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:704)
        at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:969)
        at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:841)
        at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:668)
        at java.awt.Component.dispatchEventImpl(Component.java:4502)
        at java.awt.Container.dispatchEventImpl(Container.java:2099)
        at java.awt.Window.dispatchEventImpl(Window.java:2475)
        at java.awt.Component.dispatchEvent(Component.java:4460)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
        at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:153)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Comment 3 Vladimir Voskresensky 2011-09-22 12:14:16 UTC
Created attachment 111031 [details]
IDE hangs on typing for minute

thread dump during hang
Comment 4 Vladimir Voskresensky 2011-09-22 12:17:18 UTC
How to reproduce:
open code base which takes time for Checking For External Changes activity (I use cnd sources)
switch from and back to IDE
wait till progress bar Checking For External Changes appears
try to type or paste of anything else => IDE hangs
Comment 5 Tomas Zezula 2011-09-22 12:41:52 UTC
Unfortunately I have nothing in common with "Checking for external changes".
It's not related to parsing.api (scanning).
"Checking for external changes" comes from platform (filesystems) which tries to find dirty files when you return back to IDE. It's IO intensive and it probably blocks the:

org.netbeans.modules.masterfs.filebasedfs.naming.NamingFactory.fromFile(NamingFactory.java:64)
        - waiting to lock <0xddfac250> (a java.lang.Class for
org.netbeans.modules.masterfs.filebasedfs.naming.NamingFactory)
        at
org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObjectFactory.create(FileObjectFactory.java:418)
        at
org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObjectFactory.getOrCreat

What I can try to do is to somehow stop the "Checking for external changes". As far as I know there is some friend api in masterfs to do it.
I still think that on platform which are supported by native OS Notifier the "Checking for external changes" should not be done. Unfortunately it's not true as the OS Notifier is used only for FileObjects where the FileUtil.addRecursiveListener was used for rest the "Checking for external changes" is done.
Comment 6 Vladimir Voskresensky 2011-09-22 12:46:14 UTC
Tomas, I know you are not in common with "Checking for external changes". I just saw that AWT is blocked starting from
 indexing.Context.<init>(Context.java:100)
so I thought we should evaluate if it's possible to eleminate queries to FileSystem per typed symbol
Comment 7 Tomas Zezula 2011-09-22 12:58:05 UTC
The query asks for FileObject for some path which definitely exists in this time but it block in:
org.netbeans.modules.masterfs.filebasedfs.naming.NamingFactory.fromFile(NamingFactory.java:64)
        - waiting to lock <0xddfac250> (a java.lang.Class for
org.netbeans.modules.masterfs.filebasedfs.naming.NamingFactory)

Unfortunately the API uses FileObject not (java.io.File) so the FileObject has to be created.
The parsing.api does not do any IO in this call (except of FO creation). It creates the FO
and returns it to caller who in most cases takes its URL and remember it is some set.
What I can try is to create the FO on demand and add URL version of method on Context.
Comment 8 Tomas Zezula 2011-10-03 12:03:42 UTC
Fixed jet-main: a0844dbf1f60

I've changed the Context to resolve the FileObject on demand (the JavaIndex does not need it),
I didn't use priorityIO for now but if someone else will try to resolve FileObject he will get the same
problem. If some indexer will resolve FO in markDirty I will need to put there the priorityIO.

Unfortunately I am not able to reproduce it on Mac, so I am not able to reproduce it. According to status of the issue #197985 (FIXED) there should be no "Checking for external changes" on OS which have native notifiers (Mac, Windows, Linux, Solaris) and if they are working correctly.
Comment 9 Quality Engineering 2011-10-05 14:13:19 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/a0844dbf1f60
User: Tomas Zezula <tzezula@netbeans.org>
Log: #202490:LowPerformance took 51850 ms.