Bug 75930

Summary: Deadlock when parsing current file simultaneously with background parsing
Product: cnd Reporter: Vladimir Kvashin <vkvashin>
Component: -- Other --Assignee: Vladimir Kvashin <vkvashin>
Status: RESOLVED DUPLICATE QA Contact: issues <issues.netbeans.org>
Priority: P1    
Version: 5.x   
Target Milestone: TBD   
Hardware: All   
OS: All   
Whiteboard: CND-Preview-3
Issue Type: DEFECT Exception Report:
Bug Depends on: 77165    
Bug Blocks:    

Description Vladimir Kvashin 2006-05-04 14:54:08 UTC
Deadlock when parsing current file simultaneously with background parsing.


Found one Java-level deadlock:
=============================
"editor.completion":
  waiting to lock monitor 0x081b2ff4 (object 0xb9f873d0, a java.lang.Object),
  which is held by "Default RequestProcessor"
"Default RequestProcessor":
  waiting to lock monitor 0x081b3174 (object 0xba4b5478, a
org.netbeans.modules.cnd.modelimpl.csm.core.Notificator),
  which is held by "editor.completion"

Java stack information for the threads listed above:
===================================================
"editor.completion":
        at
org.netbeans.modules.cnd.modelimpl.csm.core.ProjectBase.getGlobalNamespace(ProjectBase.java:43)
        - waiting to lock <0xb9f873d0> (a java.lang.Object)
        at
org.netbeans.modules.cnd.classview.model.ProjectNode.update(ProjectNode.java:86)
        at
org.netbeans.modules.cnd.classview.model.BaseNode.update(BaseNode.java:43)
        at
org.netbeans.modules.cnd.classview.ClassViewModel.update(ClassViewModel.java:138)
        at
org.netbeans.modules.cnd.classview.ClassViewModel.update(ClassViewModel.java:133)
        at
org.netbeans.modules.cnd.classview.ClassView.modelChanged(ClassView.java:109)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.ModelImpl.fireModelChanged(ModelImpl.java:112)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.Notificator.doEndTransaction(Notificator.java:186)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.Notificator.endTransaction(Notificator.java:81)
        - locked <0xba4b5478> (a
org.netbeans.modules.cnd.modelimpl.csm.core.Notificator)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.FileImpl.reparse(FileImpl.java:133)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.FileImpl.getDeclarations(FileImpl.java:338)
        at
org.netbeans.modules.cnd.completion.csm.CsmDeclarationResolver.findInnerFileDeclaration(CsmDeclarationResolver.java:85)
        at
org.netbeans.modules.cnd.completion.csm.CsmOffsetResolver.findObjectWithContext(CsmOffsetResolver.java:73)
        at
org.netbeans.modules.cnd.completion.csm.CsmOffsetResolver.findContext(CsmOffsetResolver.java:121)
        at
org.netbeans.modules.cnd.completion.csm.CompletionResolverImpl.resolve(CompletionResolverImpl.java:137)
        at
org.netbeans.modules.cnd.completion.cplusplus.ext.CsmCompletionQuery$Context.resolveItem(CsmCompletionQuery.java:755)
        at
org.netbeans.modules.cnd.completion.cplusplus.ext.CsmCompletionQuery$Context.resolveExp(CsmCompletionQuery.java:682)
        at
org.netbeans.modules.cnd.completion.cplusplus.ext.CsmCompletionQuery.getResult(CsmCompletionQuery.java:173)
        at
org.netbeans.modules.cnd.completion.cplusplus.ext.CsmCompletionQuery.query(CsmCompletionQuery.java:160)
        at
org.netbeans.modules.cnd.completion.cplusplus.ext.CsmCompletionQuery.query(CsmCompletionQuery.java:90)
        at org.netbeans.editor.ext.Completion.performQuery(Completion.java:589)
        at org.netbeans.editor.ext.Completion.access$700(Completion.java:47)
        at org.netbeans.editor.ext.Completion$1QueryTask.run(Completion.java:515)
        at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:516)
        at
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:949)
"Default RequestProcessor":
        at
org.netbeans.modules.cnd.modelimpl.csm.core.Notificator.block(Notificator.java:50)
        - waiting to lock <0xba4b5478> (a
org.netbeans.modules.cnd.modelimpl.csm.core.Notificator)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.ProjectBase.ensureAllParsed(ProjectBase.java:135)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.ProjectBase.ensureAllParsed(ProjectBase.java:130)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.ProjectImpl.ensureAllParsed(ProjectImpl.java:122)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.ProjectBase.findClassifier(ProjectBase.java:94)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.Resolver1.findClassifier(Resolver1.java:44)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.Resolver1.resolve(Resolver1.java:105)
        at
org.netbeans.modules.cnd.modelimpl.csm.FunctionDefinitionImpl.getDeclaration(FunctionDefinitionImpl.java:50)
        at
org.netbeans.modules.cnd.modelimpl.csm.FunctionDefinitionImpl.getQualifiedName(FunctionDefinitionImpl.java:98)
        at
org.netbeans.modules.cnd.modelimpl.csm.FunctionImpl.getUniqueName(FunctionImpl.java:87)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.ProjectBase.registerDeclaration(ProjectBase.java:115)
        at
org.netbeans.modules.cnd.modelimpl.csm.FunctionImpl.registerInProject(FunctionImpl.java:51)
        at
org.netbeans.modules.cnd.modelimpl.csm.FunctionImpl.<init>(FunctionImpl.java:44)
        at
org.netbeans.modules.cnd.modelimpl.csm.FunctionDefinitionImpl.<init>(FunctionDefinitionImpl.java:36)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.AstRenderer.render(AstRenderer.java:80)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.AstRenderer.render(AstRenderer.java:57)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.AstRenderer.render(AstRenderer.java:57)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.AstRenderer.render(AstRenderer.java:43)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.FileImpl.render(FileImpl.java:114)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.FileImpl.parse(FileImpl.java:172)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.ProjectImpl.findFile(ProjectImpl.java:54)
        - locked <0xb9f5d088> (a java.util.HashMap)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.ProjectImpl.parseIfNeed(ProjectImpl.java:41)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.ProjectBase$1.visit(ProjectBase.java:158)
        at
org.netbeans.modules.cnd.modelimpl.platform.ModelSupport.visitNativeFileItems(ModelSupport.java:202)
        at
org.netbeans.modules.cnd.modelimpl.platform.ModelSupport.visitProjectFiles(ModelSupport.java:221)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.ProjectBase.parseAllIfNeed(ProjectBase.java:156)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.ProjectBase.ensureAllParsed(ProjectBase.java:144)
        - locked <0xb9f55670> (a
org.netbeans.modules.cnd.modelimpl.csm.core.ProjectImpl)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.ProjectBase.ensureAllParsed(ProjectBase.java:130)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.ProjectImpl.ensureAllParsed(ProjectImpl.java:122)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.ProjectBase.findClassifier(ProjectBase.java:94)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.Resolver1.findClassifier(Resolver1.java:44)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.Resolver1.resolve(Resolver1.java:105)
        at
org.netbeans.modules.cnd.modelimpl.csm.FunctionDefinitionImpl.getDeclaration(FunctionDefinitionImpl.java:50)
        at
org.netbeans.modules.cnd.modelimpl.csm.FunctionDefinitionImpl.getQualifiedName(FunctionDefinitionImpl.java:98)
        at
org.netbeans.modules.cnd.modelimpl.csm.FunctionImpl.getUniqueName(FunctionImpl.java:87)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.ProjectBase.registerDeclaration(ProjectBase.java:115)
        at
org.netbeans.modules.cnd.modelimpl.csm.FunctionImpl.registerInProject(FunctionImpl.java:51)
        at
org.netbeans.modules.cnd.modelimpl.csm.FunctionImpl.<init>(FunctionImpl.java:44)
        at
org.netbeans.modules.cnd.modelimpl.csm.FunctionDefinitionImpl.<init>(FunctionDefinitionImpl.java:36)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.AstRenderer.render(AstRenderer.java:73)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.AstRenderer.render(AstRenderer.java:57)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.AstRenderer.render(AstRenderer.java:57)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.AstRenderer.render(AstRenderer.java:43)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.FileImpl.render(FileImpl.java:114)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.FileImpl.parse(FileImpl.java:172)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.ProjectImpl.findFile(ProjectImpl.java:54)
        - locked <0xb9f5d088> (a java.util.HashMap)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.ProjectImpl.parseIfNeed(ProjectImpl.java:41)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.ProjectBase$1.visit(ProjectBase.java:158)
        at
org.netbeans.modules.cnd.modelimpl.platform.ModelSupport.visitNativeFileItems(ModelSupport.java:202)
        at
org.netbeans.modules.cnd.modelimpl.platform.ModelSupport.visitProjectFiles(ModelSupport.java:221)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.ProjectBase.parseAllIfNeed(ProjectBase.java:156)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.ProjectBase.ensureAllParsed(ProjectBase.java:137)
        at
org.netbeans.modules.cnd.modelimpl.csm.core.ProjectBase.getGlobalNamespace(ProjectBase.java:46)
        - locked <0xb9f873d0> (a java.lang.Object)
        at
org.netbeans.modules.cnd.classview.model.ProjectNode.fill(ProjectNode.java:62)
        at
org.netbeans.modules.cnd.classview.model.ProjectNode.access$000(ProjectNode.java:33)
        at
org.netbeans.modules.cnd.classview.model.ProjectNode$1.run(ProjectNode.java:43)
        at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:516)
        at
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:949)

Found 1 deadlock.
Comment 1 Vladimir Kvashin 2006-05-04 15:01:24 UTC
The situation occurs under the following conditions.
We open large project, open class view: project is being parsed in background.
(At this time we see "Loading..." in class view). If user modidies a file in
another project and press ctrl-space (code completion), deadlock occurs.
Comment 2 _ gordonp 2006-05-10 00:34:41 UTC
Per discussion at i-team I'm raising to P1.
Comment 3 Vladimir Kvashin 2006-05-12 16:43:13 UTC
Can not reproduce. (Though I remember when I filed IZ I can reproduce it almost
100%). Probably fixed as a side effect of other fixes.
Comment 4 _ gordonp 2006-05-22 23:15:01 UTC
Changing from CND-Preview-2 to CND-Preview-3. If it still remains
unreproducible, it should be closed as WORKSFORME before we complete
preview3.
Comment 5 Vladimir Kvashin 2006-06-15 04:52:13 UTC

*** This issue has been marked as a duplicate of 77165 ***
Comment 6 Vladimir Kvashin 2006-06-15 04:53:05 UTC
In fact it's fixed by #77165 issue's fix
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo