Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 161114 - Parser called from EDT
Parser called from EDT
Status: RESOLVED DUPLICATE of bug 172363
Product: editor
Classification: Unclassified
Component: CSL (API & infrastructure)
6.x
All All
: P3 (vote)
: 6.x
Assigned To: mslama
issues@editor
:
Depends on:
Blocks: 160727
  Show dependency treegraph
 
Reported: 2009-03-25 11:11 UTC by Petr Hejl
Modified: 2009-09-30 15:31 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Hejl 2009-03-25 11:11:19 UTC
In constructor of GSfCodeTemplateFilter (which is always called from EDT) there is a chance that the user task (and
parsing as well) will be executed at the same thread - EDT. This could be fine for one specific language that would
guarantee that parser is fast enough (on the other hand can any parser guarantee that?), but for the generic solution
with multiple languages it just can't use the EDT to do the parsing imo.
Comment 1 Petr Hejl 2009-03-25 11:12:50 UTC
Sample EDT stack (groovy):
"AWT-EventQueue-1" prio=6 tid=0x02ec3000 nid=0x9c8 runnable [0x067dd000..0x067dfb14]
   java.lang.Thread.State: RUNNABLE
	at java.io.WinNTFileSystem.checkAccess(Native Method)
	at java.io.File.canRead(File.java:691)
	at org.netbeans.modules.java.source.parsing.FolderArchive.getFiles(FolderArchive.java:104)
	at org.netbeans.modules.java.source.parsing.CachingFileManager.list(CachingFileManager.java:116)
	at org.netbeans.modules.java.source.parsing.OutputFileManager.list(OutputFileManager.java:105)
	at org.netbeans.modules.java.source.parsing.ProxyFileManager.list(ProxyFileManager.java:174)
	at com.sun.tools.javac.jvm.ClassReader.fillIn(ClassReader.java:2203)
	at com.sun.tools.javac.jvm.ClassReader.complete(ClassReader.java:1840)
	at com.sun.tools.javac.code.Symbol.complete(Symbol.java:405)
	at com.sun.tools.javac.jvm.ClassReader.completeOwners(ClassReader.java:1852)
	at com.sun.tools.javac.jvm.ClassReader.complete(ClassReader.java:1831)
	at com.sun.tools.javac.code.Symbol.complete(Symbol.java:405)
	at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:800)
	at com.sun.tools.javac.jvm.ClassReader.loadClass(ClassReader.java:2018)
	at com.sun.tools.javac.comp.Resolve.loadClass(Resolve.java:870)
	at com.sun.tools.javac.comp.Resolve.findIdentInPackage(Resolve.java:1040)
	at com.sun.tools.javac.comp.Attr$IdentAttributer.visitMemberSelect(Attr.java:284)
	at com.sun.tools.javac.comp.Attr$IdentAttributer.visitMemberSelect(Attr.java:273)
	at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1661)
	at com.sun.source.util.SimpleTreeVisitor.visit(SimpleTreeVisitor.java:52)
	at com.sun.tools.javac.comp.Attr$IdentAttributer.visitMemberSelect(Attr.java:276)
	at com.sun.tools.javac.comp.Attr$IdentAttributer.visitMemberSelect(Attr.java:273)
	at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1661)
	at com.sun.source.util.SimpleTreeVisitor.visit(SimpleTreeVisitor.java:52)
	at com.sun.tools.javac.comp.Attr$IdentAttributer.visitMemberSelect(Attr.java:276)
	at com.sun.tools.javac.comp.Attr$IdentAttributer.visitMemberSelect(Attr.java:273)
	at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1661)
	at com.sun.source.util.SimpleTreeVisitor.visit(SimpleTreeVisitor.java:52)
	at com.sun.tools.javac.comp.Attr$IdentAttributer.visitMemberSelect(Attr.java:276)
	at com.sun.tools.javac.comp.Attr$IdentAttributer.visitMemberSelect(Attr.java:273)
	at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1661)
	at com.sun.source.util.SimpleTreeVisitor.visit(SimpleTreeVisitor.java:52)
	at com.sun.tools.javac.comp.Attr$IdentAttributer.visitMemberSelect(Attr.java:276)
	at com.sun.tools.javac.comp.Attr$IdentAttributer.visitMemberSelect(Attr.java:273)
	at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1661)
	at com.sun.source.util.SimpleTreeVisitor.visit(SimpleTreeVisitor.java:52)
	at com.sun.tools.javac.comp.Attr$IdentAttributer.visitMemberSelect(Attr.java:276)
	at com.sun.tools.javac.comp.Attr$IdentAttributer.visitMemberSelect(Attr.java:273)
	at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1661)
	at com.sun.tools.javac.comp.Attr.attribIdent(Attr.java:269)
	at com.sun.tools.javac.main.JavaCompiler.resolveIdent(JavaCompiler.java:646)
	at com.sun.tools.javac.model.JavacElements.nameToSymbol(JavacElements.java:205)
	at com.sun.tools.javac.model.JavacElements.getTypeElement(JavacElements.java:152)
	at com.sun.tools.javac.model.JavacElements.getTypeElement(JavacElements.java:61)
	at org.netbeans.modules.groovy.editor.api.parser.NbCompilationUnit$NbCompileUnit$1.run(NbCompilationUnit.java:93)
	at org.netbeans.modules.groovy.editor.api.parser.NbCompilationUnit$NbCompileUnit$1.run(NbCompilationUnit.java:91)
	at org.netbeans.api.java.source.JavaSource$MimeTask.run(JavaSource.java:517)
	at org.netbeans.modules.parsing.api.ParserManager$MimeTaskAction.run(ParserManager.java:214)
	at org.netbeans.modules.parsing.api.ParserManager$MimeTaskAction.run(ParserManager.java:198)
	at org.netbeans.modules.parsing.impl.TaskProcessor.runUserTask(TaskProcessor.java:188)
	at org.netbeans.modules.parsing.api.ParserManager.parse(ParserManager.java:186)
	at org.netbeans.api.java.source.JavaSource.runUserActionTaskImpl(JavaSource.java:384)
	at org.netbeans.api.java.source.JavaSource.runUserActionTask(JavaSource.java:376)
	at org.netbeans.modules.groovy.editor.api.parser.NbCompilationUnit$NbCompileUnit.getClass(NbCompilationUnit.java:102)
	at org.codehaus.groovy.control.ResolveVisitor.resolveFromCompileUnit(ResolveVisitor.java:427)
	at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:251)
	at org.codehaus.groovy.control.ResolveVisitor.resolveFromModule(ResolveVisitor.java:564)
	at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:251)
	at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:219)
	at org.codehaus.groovy.control.ResolveVisitor.resolveOrFail(ResolveVisitor.java:203)
	at org.codehaus.groovy.control.ResolveVisitor.resolveOrFail(ResolveVisitor.java:215)
	at org.codehaus.groovy.control.ResolveVisitor.transformConstructorCallExpression(ResolveVisitor.java:884)
	at org.codehaus.groovy.control.ResolveVisitor.transform(ResolveVisitor.java:649)
	at org.codehaus.groovy.ast.expr.TernaryExpression.transformExpression(TernaryExpression.java:47)
	at org.codehaus.groovy.control.ResolveVisitor.transform(ResolveVisitor.java:654)
	at org.codehaus.groovy.control.ResolveVisitor.transformDeclarationExpression(ResolveVisitor.java:912)
	at org.codehaus.groovy.control.ResolveVisitor.transform(ResolveVisitor.java:641)
	at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitExpressionStatement(ClassCodeExpressionTransformer.java:148)
	at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:40)
	at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:37)
	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:129)
	at org.codehaus.groovy.control.ResolveVisitor.visitBlockStatement(ResolveVisitor.java:1021)
	at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:52)
	at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitIfElse(ClassCodeExpressionTransformer.java:84)
	at org.codehaus.groovy.ast.stmt.IfStatement.visit(IfStatement.java:41)
	at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:37)
	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:129)
	at org.codehaus.groovy.control.ResolveVisitor.visitBlockStatement(ResolveVisitor.java:1021)
	at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:52)
	at org.codehaus.groovy.control.ResolveVisitor.transformClosureExpression(ResolveVisitor.java:877)
	at org.codehaus.groovy.control.ResolveVisitor.transform(ResolveVisitor.java:647)
	at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitField(ClassCodeExpressionTransformer.java:70)
	at org.codehaus.groovy.control.ResolveVisitor.visitField(ResolveVisitor.java:175)
	at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:897)
	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:48)
	at org.codehaus.groovy.control.ResolveVisitor.visitClass(ResolveVisitor.java:1000)
	at org.codehaus.groovy.control.ResolveVisitor.startResolving(ResolveVisitor.java:141)
	at org.codehaus.groovy.control.CompilationUnit$5.call(CompilationUnit.java:527)
	at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:772)
	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:438)
	at org.netbeans.modules.groovy.editor.api.parser.GroovyParser.parseBuffer(GroovyParser.java:477)
	at org.netbeans.modules.groovy.editor.api.parser.GroovyParser.parse(GroovyParser.java:141)
	at org.netbeans.modules.parsing.impl.SourceCache.getResult(SourceCache.java:194)
	at org.netbeans.modules.parsing.api.ResultIterator.getParserResult(ResultIterator.java:128)
	at org.netbeans.modules.parsing.api.ResultIterator.getParserResult(ResultIterator.java:141)
	at org.netbeans.modules.csl.editor.codetemplates.GsfCodeTemplateFilter.run(GsfCodeTemplateFilter.java:117)
	at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:128)
	at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:112)
	at org.netbeans.modules.parsing.impl.TaskProcessor.runUserTask(TaskProcessor.java:188)
	at org.netbeans.modules.parsing.impl.TaskProcessor.runWhenScanFinished(TaskProcessor.java:244)
	at org.netbeans.modules.parsing.api.ParserManager.parseWhenScanFinished(ParserManager.java:105)
	at org.netbeans.modules.csl.editor.codetemplates.GsfCodeTemplateFilter.<init>(GsfCodeTemplateFilter.java:83)
	at org.netbeans.modules.csl.editor.codetemplates.GsfCodeTemplateFilter.<init>(GsfCodeTemplateFilter.java:70)
	at org.netbeans.modules.csl.editor.codetemplates.GsfCodeTemplateFilter$Factory.createFilter(GsfCodeTemplateFilter.java:133)
	at
org.netbeans.lib.editor.codetemplates.CodeTemplateManagerOperation.getTemplateFilters(CodeTemplateManagerOperation.java:226)
	at org.netbeans.lib.editor.codetemplates.SurroundWithFix.getFixes(SurroundWithFix.java:71)
	at org.netbeans.lib.editor.codetemplates.AbbrevDetection.showSurroundWithHint(AbbrevDetection.java:424)
	at org.netbeans.lib.editor.codetemplates.AbbrevDetection.access$100(AbbrevDetection.java:93)
	at org.netbeans.lib.editor.codetemplates.AbbrevDetection$1.actionPerformed(AbbrevDetection.java:186)
	at javax.swing.Timer.fireActionPerformed(Timer.java:271)
	at javax.swing.Timer$DoPostEvent.run(Timer.java:201)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
	at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:104)
	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 2 Vitezslav Stejskal 2009-03-25 16:47:15 UTC
It computes the list of applicable templates, which IMO does not have to be computed immediately in the constructor. Do
you guys have a testcase where this is causing problems?
Comment 3 Petr Hejl 2009-03-26 10:06:46 UTC
From netcat - could be related:

I have been working on a few ruby and RoR files and noticed that when editing and I have highlighted some text, the
system is very slow in processing my request.

Sometime the request  takes up to 20 seconds to process for something as simple as copying one line of text (< 80
characters).

Current Version is dev 200903250219.
Comment 4 David Strupl 2009-06-08 13:59:36 UTC
Marek, these are yours now ...
Comment 5 Petr Hejl 2009-09-30 15:31:17 UTC

*** This issue has been marked as a duplicate of 172363 ***


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo