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 221840 - html indexing slow - firing events from indexer
Summary: html indexing slow - firing events from indexer
Status: RESOLVED FIXED
Alias: None
Product: web
Classification: Unclassified
Component: CSS Editor (show other bugs)
Version: 7.2
Hardware: All All
: P3 normal (vote)
Assignee: Marek Fukala
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-09 15:23 UTC by Petah
Modified: 2012-11-30 02:39 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 194833


Attachments
stacktrace (1.79 KB, text/plain)
2012-11-09 15:23 UTC, Petah
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Petah 2012-11-09 15:23:19 UTC
This issue was reported manually by sdedic.
It already has 1 duplicates 


Build: NetBeans IDE 7.2 (Build 201207171143)
VM: Java HotSpot(TM) Client VM, 20.0-b11, Java(TM) SE Runtime Environment, 1.6.0_25-b06
OS: Windows 7

User Comments:
petah: Scanning is too slow and make NB unresponsive




Stacktrace: 
java.lang.Exception: Scan canceled.
   at java.lang.Thread.getStackTrace(Thread.java:1479)
   at org.netbeans.modules.parsing.impl.indexing.LogContext.create(LogContext.java:113)
   at org.netbeans.modules.parsing.impl.indexing.LogContext.create(LogContext.java:106)
   at org.netbeans.modules.parsing.impl.indexing.PathRegistry.scheduleFirer(PathRegistry.java:820)
   at org.netbeans.modules.parsing.impl.indexing.PathRegistry.resetCacheAndFire(PathRegistry.java:814)
   at org.netbeans.modules.parsing.impl.indexing.PathRegistry.access$500(PathRegistry.java:85)
Comment 1 Petah 2012-11-09 15:23:22 UTC
Created attachment 127486 [details]
stacktrace
Comment 2 Svata Dedic 2012-11-09 15:24:26 UTC
There's a reported cycle between CSS nodes in the log, maybe it contributes to the long scanning time. Please check.
Comment 3 Svata Dedic 2012-11-12 08:16:29 UTC
Graph cycle is reported in the log, CSS indexer runs for a long time. Please check.
Comment 4 Exceptions Reporter 2012-11-23 10:20:05 UTC
This bug already has 5 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=194833
Comment 5 Marek Fukala 2012-11-28 14:27:23 UTC
The latest report from 7.3 is cause by the recently added support for firing changes from the html indexer. A RequestProcessor task is posted on each file scanned.
Comment 6 Marek Fukala 2012-11-28 14:50:26 UTC
fixed in web-main#b1e63790d120

Now the html indexer doesn't fire the change events from the index(...) method for each indexed files, but fires it  for each indexer.filesDirty(...) per an indexing root.

Remote files seems to work fine, Davide please verify as I may not understand all the aspects of its behaviour.
Comment 7 David Konecny 2012-11-28 21:11:36 UTC
Thanks Marek, the fix makes sense to me. Sorry about that.

I do not think though that it was the cause of this problem. The problem existed before my changes and the latest report does not indicate that posting runnable into dedicated RP is what caused the slowdown, no?

On the other hand there are few hundreds of suspicous lines saying:

INFO [CssParser]: Created instance org.netbeans.modules.css.lib.nbparser.CssParser@1f387ae
Comment 8 Marek Fukala 2012-11-28 22:32:03 UTC
(In reply to comment #7)
> Thanks Marek, the fix makes sense to me. Sorry about that.
> 
> I do not think though that it was the cause of this problem. The problem
> existed before my changes and the latest report does not indicate that posting
> runnable into dedicated RP is what caused the slowdown, no?
Hmm, I think so - I saw the exception.fillInStacktrace() triggered from the RP.post() in the stacks which from my previous experience is very slow and causes a big perf. degradation if called too often (which was exactly the case). But I cannot guarantee it is the only culprit.
> 
> On the other hand there are few hundreds of suspicous lines saying:
> 
> INFO [CssParser]: Created instance
> org.netbeans.modules.css.lib.nbparser.CssParser@1f387ae
This was just some forgotten logging. Should not harm much, at least I've fixed this some tima ago.

Thanks David for the verification.
Comment 9 Marek Fukala 2012-11-28 22:37:21 UTC
FYI this is wat I ment :
Thread id 78, "RepositoryUpdater.worker" (WAITING):
	java.lang.Throwable.fillInStackTrace(Native Method)
	org.openide.util.RequestProcessor$SlowItem.fillInStackTrace(RequestProcessor.java:1854)
	java.lang.Throwable.<init>(Throwable.java:181)
	java.lang.Exception.<init>(Exception.java:29)
	org.openide.util.RequestProcessor$Item.<init>(RequestProcessor.java:1768)
	org.openide.util.RequestProcessor$SlowItem.<init>(RequestProcessor.java:1849)
	org.openide.util.RequestProcessor$Task.schedule(RequestProcessor.java:1517)
	org.openide.util.RequestProcessor$Task.schedule(RequestProcessor.java:1495)
	org.openide.util.RequestProcessor.post(RequestProcessor.java:453)
	org.openide.util.RequestProcessor.post(RequestProcessor.java:424)
	org.netbeans.modules.html.editor.indexing.HtmlIndexer.fireChange(HtmlIndexer.java:107)
	org.netbeans.modules.html.editor.indexing.HtmlIndexer.index(HtmlIndexer.java:98)
	org.netbeans.modules.parsing.spi.indexing.Indexable$MyAccessor$3.run(Indexable.java:216)
...
Comment 10 David Konecny 2012-11-28 22:44:43 UTC
(In reply to comment #9)
> FYI this is wat I ment :
> Thread id 78, "RepositoryUpdater.worker" (WAITING):

I had seen it too. But that's just a thread dump of a running code. It does not says this is the bottleneck where I spent 90% of the time. On the other hand if you say that RP.post() is slow in your experience than I absolutely believe you and your fix solves that particular exception report. Thanks for that.
Comment 11 Marek Fukala 2012-11-29 08:21:59 UTC
BTW it wouldn't be an issue if we post the tasks to a RP with disabled stacktraces. This is also default RP behaviour when assertions are disabled.

see javadoc for RequestProcessor(String name, int throughput, boolean interruptThread, boolean enableStackTraces)
Comment 12 Quality Engineering 2012-11-30 02:39:35 UTC
Integrated into 'main-golden', will be available in build *201211300001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/b1e63790d120
User: Marek Fukala <mfukala@netbeans.org>
Log: #221840 - html indexing slow - firing events from indexer