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 147438 - Workspace refreshes and builds any time Java file is changed
Summary: Workspace refreshes and builds any time Java file is changed
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: Tomas Zezula
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-17 03:25 UTC by wobster
Modified: 2008-09-18 05:33 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Thread dump while IDE was "Refreshing Workspace" (27.23 KB, text/plain)
2008-09-17 03:26 UTC, wobster
Details
Log with -J-Dorg.netbeans.modules.java.source.usages.RepositoryUpdater.level=0 (47.00 KB, text/plain)
2008-09-17 03:41 UTC, wobster
Details
Log with -J-Dorg.netbeans.modules.java.source.usages.RepositoryUpdater.level=0 (47.00 KB, application/octet-stream)
2008-09-17 03:42 UTC, wobster
Details

Note You need to log in before you can comment on or make changes to this bug.
Description wobster 2008-09-17 03:25:16 UTC
I have a J2SE project with Java and Groovy files (and JPA classes, but I don't think that is relevant). Any time I make
the smallest change in one Java file, NetBeans goes into this long sequence of "Refreshing Workspace" and recompiling. I
dumped the stack using jvisualvm and noticed that there was a Groovy process running: (I will attach the full stack
trace and create trace logs as well.)

"Java Source Worker Thread" daemon prio=10 tid=0x08d84c00 nid=0x20ef in Object.wait() [0xb0d11000..0xb0d12030]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <0x6e7a29c8> (a org.openide.windows.CloneableOpenSupport$Listener)
	at java.lang.Object.wait(Object.java:485)
	at org.openide.text.CloneableEditorSupport.openDocumentImpl(CloneableEditorSupport.java:756)
	at org.openide.text.CloneableEditorSupport.openDocumentImpl(CloneableEditorSupport.java:745)
	at org.openide.text.CloneableEditorSupport.openDocumentCheckIOE(CloneableEditorSupport.java:725)
	at org.openide.text.CloneableEditorSupport.openDocument(CloneableEditorSupport.java:720)
	- locked <0x6e7a29c8> (a org.openide.windows.CloneableOpenSupport$Listener)
	at org.openide.text.DataEditorSupport.openDocument(DataEditorSupport.java:400)
	at org.netbeans.modules.groovy.editor.AstUtilities.getBaseDocument(AstUtilities.java:130)
	at org.netbeans.modules.groovy.editor.parser.SourceUtils$1.read(SourceUtils.java:75)
	at org.netbeans.modules.groovy.editor.parser.GroovyParser.parseFiles(GroovyParser.java:116)
	at org.netbeans.modules.groovy.editor.parser.SourceUtils.runUserActionTask(SourceUtils.java:102)
	at
org.netbeans.modules.groovy.editor.parser.GroovyVirtualSourceProvider.getClassNodes(GroovyVirtualSourceProvider.java:131)
	at org.netbeans.modules.groovy.editor.parser.GroovyVirtualSourceProvider.translate(GroovyVirtualSourceProvider.java:90)
	at org.netbeans.modules.java.source.usages.VirtualSourceProviderQuery.translate(VirtualSourceProviderQuery.java:125)
	at org.netbeans.modules.java.source.usages.RepositoryUpdater$CompileWorker.parseFiles(RepositoryUpdater.java:2122)
	at org.netbeans.modules.java.source.usages.RepositoryUpdater$CompileWorker.parseFiles(RepositoryUpdater.java:1822)
	at
org.netbeans.modules.java.source.usages.RepositoryUpdater$CompileWorker.compileFileFromRoots(RepositoryUpdater.java:2680)
	at org.netbeans.modules.java.source.usages.RepositoryUpdater$CompileWorker.recompile(RepositoryUpdater.java:2564)
	at org.netbeans.modules.java.source.usages.RepositoryUpdater$CompileWorker.access$3800(RepositoryUpdater.java:1239)
	at org.netbeans.modules.java.source.usages.RepositoryUpdater$CompileWorker$1.run(RepositoryUpdater.java:1575)
	at org.netbeans.modules.java.source.usages.RepositoryUpdater$CompileWorker$1.run(RepositoryUpdater.java:1281)
	at org.netbeans.modules.java.source.usages.ClassIndexManager.writeLock(ClassIndexManager.java:99)
	at org.netbeans.modules.java.source.usages.RepositoryUpdater$CompileWorker.run(RepositoryUpdater.java:1278)
	at org.netbeans.modules.java.source.usages.RepositoryUpdater$CompileWorker.run(RepositoryUpdater.java:1239)
	at org.netbeans.api.java.source.JavaSource$CompilationJob.run(JavaSource.java:1588)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
	at java.lang.Thread.run(Thread.java:619)
Comment 1 wobster 2008-09-17 03:26:58 UTC
Created attachment 69999 [details]
Thread dump while IDE was "Refreshing Workspace"
Comment 2 wobster 2008-09-17 03:41:47 UTC
Created attachment 70000 [details]
Log with -J-Dorg.netbeans.modules.java.source.usages.RepositoryUpdater.level=0
Comment 3 wobster 2008-09-17 03:42:37 UTC
Created attachment 70001 [details]
Log with -J-Dorg.netbeans.modules.java.source.usages.RepositoryUpdater.level=0
Comment 4 martin_adamek 2008-09-17 09:37:24 UTC
Can you please provide more information about how many java and groovy classes you have and how long the refresh takes?
Comment 5 Jan Lahoda 2008-09-17 12:11:47 UTC
From the log, I see the following problem:
-the user edits the file, modifies a method/field/class signature, the file is saved
-the file is compiled, and all the "dependent" files are recompiled - this is correct and is needed to show correct
error badges (among other things).
-but, as a side effect, all virtual files are recompiled - which is wrong, as it is useless (IMO), and slow

See RepositoryUpdater.compileFileFromRoots, local variable virtualFiles. As a safest fix, I think that computation and
recompilation of virtual files should be disabled when called from RU.recompile.
Comment 6 Tomas Zezula 2008-09-17 14:48:49 UTC
Caused by the groovy files which are rebuilt after save, should be easy to fix.
Thanks for report.
Comment 7 Tomas Zezula 2008-09-17 16:27:35 UTC
http://hg.netbeans.org/main/rev/d367be04b2e4
Comment 8 Quality Engineering 2008-09-18 05:33:38 UTC
Integrated into 'main-golden', will be available in build *200809180201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/d367be04b2e4
User: Tomas Zezula <tzezula@netbeans.org>
Log: #147438:Workspace refreshes and builds any time Java file is changed