Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Deadlock #498

Closed
FroMage opened this issue Sep 21, 2016 · 8 comments
Closed

Deadlock #498

FroMage opened this issue Sep 21, 2016 · 8 comments

Comments

@FroMage
Copy link
Contributor

FroMage commented Sep 21, 2016

My IDE just died.

[88118048]  ERROR - plication.impl.ApplicationImpl - Calling invokeAndWait from read-action leads to possible deadlock. 
com.intellij.openapi.diagnostic.Logger$EmptyThrowable
    at com.intellij.openapi.diagnostic.Logger.error(Logger.java:129)
    at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:728)
    at org.intellij.plugins.ceylon.ide.ceylonCode.model.IdeaModelLoader$3.$call$(IdeaModelLoader.ceylon:159)
    at ceylon.interop.java.JavaRunnable.run(JavaRunnable.ceylon:7)
    at com.redhat.ceylon.ide.common.model.BaseIdeModelLoader$1.$call$(IdeModelLoader.ceylon:166)
    at com.redhat.ceylon.ide.common.model.BaseIdeModelLoader$1anonymous_0_.call(IdeModelLoader.ceylon:133)
    at com.redhat.ceylon.model.loader.AbstractModelLoader$1.call(AbstractModelLoader.java:345)
    at org.intellij.plugins.ceylon.ide.ceylonCode.model.IdeaModelLoader$2.$call$(IdeaModelLoader.ceylon:116)
    at ceylon.interop.java.JavaRunnable.run(JavaRunnable.ceylon:7)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:950)
    at org.intellij.plugins.ceylon.ide.ceylonCode.model.IdeaModelLoader.embeddingSync(IdeaModelLoader.ceylon:115)
    at com.redhat.ceylon.model.loader.AbstractModelLoader.synchronizedCall(AbstractModelLoader.java:341)
    at com.redhat.ceylon.ide.common.model.BaseIdeModelLoader.callWithLock(IdeModelLoader.ceylon:132)
    at com.redhat.ceylon.ide.common.model.BaseIdeModelLoader.resetJavaModelSourceIfNecessary(IdeModelLoader.ceylon:163)
    at org.intellij.plugins.ceylon.ide.ceylonCode.model.IdeaModelLoader.updateIndexIfnecessary$priv$(IdeaModelLoader.ceylon:158)
    at org.intellij.plugins.ceylon.ide.ceylonCode.model.IdeaModelLoader.moduleContainsClass(IdeaModelLoader.ceylon:175)
    at com.redhat.ceylon.ide.common.model.BaseIdeModelLoader.searchAgain(IdeModelLoader.ceylon:480)
    at com.redhat.ceylon.ide.common.model.BaseIdeModelLoader.searchAgain(IdeModelLoader.ceylon:492)
    at com.redhat.ceylon.model.loader.model.LazyPackage.getDirectMember(LazyPackage.java:77)
    at com.redhat.ceylon.model.loader.model.LazyPackage.getDirectMember(LazyPackage.java:68)
    at com.redhat.ceylon.ide.common.util.SingleSourceUnitPackage.getDirectMember(SinceSourceUnitPackage.ceylon:51)
    at com.redhat.ceylon.model.typechecker.model.Package.getMemberOrParameter(Package.java:209)
    at com.redhat.ceylon.ide.common.util.SingleSourceUnitPackage.getMemberOrParameter(SinceSourceUnitPackage.ceylon:113)
    at com.redhat.ceylon.model.typechecker.model.Element.getMemberOrParameter(Element.java:170)
    at com.redhat.ceylon.model.typechecker.model.Element.getMemberOrParameter(Element.java:150)
    at com.redhat.ceylon.compiler.typechecker.analyzer.AnalyzerUtil.getTypeDeclaration(AnalyzerUtil.java:169)
    at com.redhat.ceylon.compiler.typechecker.analyzer.DeclarationVisitor$6.initDeclaration(DeclarationVisitor.java:2644)
    at com.redhat.ceylon.model.typechecker.model.LazyType.getDeclaration(LazyType.java:32)
    at com.redhat.ceylon.compiler.typechecker.analyzer.SupertypeVisitor.checkForUndecidability(SupertypeVisitor.java:94)
    at com.redhat.ceylon.compiler.typechecker.analyzer.SupertypeVisitor.visit(SupertypeVisitor.java:229)
    at com.redhat.ceylon.compiler.typechecker.tree.Tree$ClassDefinition.visit(Tree.java:945)
    at com.redhat.ceylon.compiler.typechecker.tree.Walker.walkCompilationUnit(Walker.java:30)
    at com.redhat.ceylon.compiler.typechecker.tree.Tree$CompilationUnit.visitChildren(Tree.java:30)
    at com.redhat.ceylon.compiler.typechecker.tree.Visitor.visitAny(Visitor.java:24)
    at com.redhat.ceylon.compiler.typechecker.tree.Visitor.visit(Visitor.java:26)
    at com.redhat.ceylon.compiler.typechecker.tree.Tree$CompilationUnit.visit(Tree.java:22)
    at com.redhat.ceylon.compiler.typechecker.context.PhasedUnit.scanTypeDeclarations(PhasedUnit.java:387)
    at org.intellij.plugins.ceylon.ide.ceylonCode.psi.CeylonLocalAnalyzer$31$5.$call$(CeylonLocalAnalyzer.ceylon:556)
    at org.intellij.plugins.ceylon.ide.ceylonCode.psi.CeylonLocalAnalyzer$31.$call$(CeylonLocalAnalyzer.ceylon:566)
    at org.intellij.plugins.ceylon.ide.ceylonCode.psi.CeylonLocalAnalyzer$31.$call$(CeylonLocalAnalyzer.ceylon:524)
    at org.intellij.plugins.ceylon.ide.ceylonCode.model.concurrencyManager_.withIndexStrategy$priv$(concurrencyManager.ceylon:207)
    at org.intellij.plugins.ceylon.ide.ceylonCode.model.concurrencyManager_.withAlternateResolution(concurrencyManager.ceylon:219)
    at org.intellij.plugins.ceylon.ide.ceylonCode.psi.CeylonLocalAnalyzer.createPhasedUnitAndTypecheck$priv$(CeylonLocalAnalyzer.ceylon:524)
    at org.intellij.plugins.ceylon.ide.ceylonCode.psi.CeylonLocalAnalyzer.access$1800(CeylonLocalAnalyzer.ceylon:116)
    at org.intellij.plugins.ceylon.ide.ceylonCode.psi.CeylonLocalAnalyzer$30.$call$(CeylonLocalAnalyzer.ceylon:482)
    at com.redhat.ceylon.ide.common.model.BaseCeylonProject.withSourceModel$canonical$(CeylonProject.ceylon:446)
    at com.redhat.ceylon.ide.common.model.BaseCeylonProject.withSourceModel(CeylonProject.ceylon:438)
    at org.intellij.plugins.ceylon.ide.ceylonCode.psi.CeylonLocalAnalyzer.typecheckSourceFile$priv$(CeylonLocalAnalyzer.ceylon:411)
    at org.intellij.plugins.ceylon.ide.ceylonCode.psi.CeylonLocalAnalyzer.access$1200(CeylonLocalAnalyzer.ceylon:116)
    at org.intellij.plugins.ceylon.ide.ceylonCode.psi.CeylonLocalAnalyzer$13.$call$(CeylonLocalAnalyzer.ceylon:277)
    at org.intellij.plugins.ceylon.ide.ceylonCode.psi.CeylonLocalAnalyzer$9.$call$(CeylonLocalAnalyzer.ceylon:204)
    at ceylon.interop.java.JavaRunnable.run(JavaRunnable.ceylon:7)
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
    at com.intellij.util.Alarm$Request$1.run(Alarm.java:378)
    at com.intellij.util.Alarm$Request.run(Alarm.java:389)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at com.intellij.util.concurrency.SchedulingWrapper$MyScheduledFutureTask.run(SchedulingWrapper.java:227)
    at com.intellij.util.concurrency.BoundedTaskExecutor$2.run(BoundedTaskExecutor.java:187)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
@FroMage FroMage added this to the 1.3.0-1 milestone Sep 21, 2016
@FroMage
Copy link
Contributor Author

FroMage commented Sep 21, 2016

Got it again, slightly different stack:

atlantis stephane 13:06 build-system $ [6226123]  ERROR - plication.impl.ApplicationImpl - Calling invokeAndWait from read-action leads to possible deadlock. 
com.intellij.openapi.diagnostic.Logger$EmptyThrowable
    at com.intellij.openapi.diagnostic.Logger.error(Logger.java:129)
    at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:728)
    at org.intellij.plugins.ceylon.ide.ceylonCode.model.IdeaModelLoader$3.$call$(IdeaModelLoader.ceylon:159)
    at ceylon.interop.java.JavaRunnable.run(JavaRunnable.ceylon:7)
    at com.redhat.ceylon.ide.common.model.BaseIdeModelLoader$1.$call$(IdeModelLoader.ceylon:166)
    at com.redhat.ceylon.ide.common.model.BaseIdeModelLoader$1anonymous_0_.call(IdeModelLoader.ceylon:133)
    at com.redhat.ceylon.model.loader.AbstractModelLoader$1.call(AbstractModelLoader.java:345)
    at org.intellij.plugins.ceylon.ide.ceylonCode.model.IdeaModelLoader$2.$call$(IdeaModelLoader.ceylon:116)
    at ceylon.interop.java.JavaRunnable.run(JavaRunnable.ceylon:7)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:950)
    at org.intellij.plugins.ceylon.ide.ceylonCode.model.IdeaModelLoader.embeddingSync(IdeaModelLoader.ceylon:115)
    at com.redhat.ceylon.model.loader.AbstractModelLoader.synchronizedCall(AbstractModelLoader.java:341)
    at com.redhat.ceylon.ide.common.model.BaseIdeModelLoader.callWithLock(IdeModelLoader.ceylon:132)
    at com.redhat.ceylon.ide.common.model.BaseIdeModelLoader.resetJavaModelSourceIfNecessary(IdeModelLoader.ceylon:163)
    at org.intellij.plugins.ceylon.ide.ceylonCode.model.IdeaModelLoader.updateIndexIfnecessary$priv$(IdeaModelLoader.ceylon:158)
    at org.intellij.plugins.ceylon.ide.ceylonCode.model.IdeaModelLoader.moduleContainsClass(IdeaModelLoader.ceylon:175)
    at com.redhat.ceylon.ide.common.model.BaseIdeModelLoader.searchAgain(IdeModelLoader.ceylon:480)
    at com.redhat.ceylon.ide.common.model.BaseIdeModelLoader.searchAgain(IdeModelLoader.ceylon:492)
    at com.redhat.ceylon.model.loader.model.LazyPackage.getDirectMember(LazyPackage.java:77)
    at com.redhat.ceylon.model.loader.model.LazyPackage.getDirectMember(LazyPackage.java:68)
    at com.redhat.ceylon.model.typechecker.model.Package.getMemberOrParameter(Package.java:209)
    at com.redhat.ceylon.ide.common.util.SingleSourceUnitPackage.getMemberOrParameter(SinceSourceUnitPackage.ceylon:111)
    at com.redhat.ceylon.compiler.typechecker.analyzer.AnalyzerUtil.getTypedDeclaration(AnalyzerUtil.java:131)
    at com.redhat.ceylon.compiler.typechecker.analyzer.ExpressionVisitor.resolveBaseMemberExpression(ExpressionVisitor.java:6549)
    at com.redhat.ceylon.compiler.typechecker.analyzer.ExpressionVisitor.visit(ExpressionVisitor.java:6471)
    at com.redhat.ceylon.compiler.typechecker.tree.Tree$BaseMemberExpression.visit(Tree.java:6403)
    at com.redhat.ceylon.compiler.typechecker.analyzer.ExpressionVisitor.visit(ExpressionVisitor.java:2950)
    at com.redhat.ceylon.compiler.typechecker.tree.Visitor.visit(Visitor.java:317)
    at com.redhat.ceylon.compiler.typechecker.tree.Tree$Annotation.visit(Tree.java:7850)
    at com.redhat.ceylon.compiler.typechecker.tree.Walker.walkAnnotationList(Walker.java:1777)
    at com.redhat.ceylon.compiler.typechecker.tree.Tree$AnnotationList.visitChildren(Tree.java:7910)
    at com.redhat.ceylon.compiler.typechecker.tree.Visitor.visitAny(Visitor.java:24)
    at com.redhat.ceylon.compiler.typechecker.tree.Visitor.visit(Visitor.java:319)
    at com.redhat.ceylon.compiler.typechecker.tree.Tree$AnnotationList.visit(Tree.java:7902)
    at com.redhat.ceylon.compiler.typechecker.tree.Walker.walkDeclaration(Walker.java:139)
    at com.redhat.ceylon.compiler.typechecker.tree.Walker.walkTypeDeclaration(Walker.java:149)
    at com.redhat.ceylon.compiler.typechecker.tree.Walker.walkClassOrInterface(Walker.java:155)
    at com.redhat.ceylon.compiler.typechecker.tree.Walker.walkAnyClass(Walker.java:234)
    at com.redhat.ceylon.compiler.typechecker.tree.Walker.walkClassDefinition(Walker.java:248)
    at com.redhat.ceylon.compiler.typechecker.tree.Tree$ClassDefinition.visitChildren(Tree.java:953)
    at com.redhat.ceylon.compiler.typechecker.tree.Visitor.visitAny(Visitor.java:24)
    at com.redhat.ceylon.compiler.typechecker.tree.Visitor.visit(Visitor.java:131)
    at com.redhat.ceylon.compiler.typechecker.tree.Visitor.visit(Visitor.java:132)
    at com.redhat.ceylon.compiler.typechecker.tree.Visitor.visit(Visitor.java:40)
    at com.redhat.ceylon.compiler.typechecker.tree.Visitor.visit(Visitor.java:42)
    at com.redhat.ceylon.compiler.typechecker.tree.Visitor.visit(Visitor.java:43)
    at com.redhat.ceylon.compiler.typechecker.tree.Visitor.visit(Visitor.java:54)
    at com.redhat.ceylon.compiler.typechecker.tree.Visitor.visit(Visitor.java:55)
    at com.redhat.ceylon.compiler.typechecker.analyzer.ExpressionVisitor.visit(ExpressionVisitor.java:2222)
    at com.redhat.ceylon.compiler.typechecker.tree.Tree$ClassDefinition.visit(Tree.java:945)
    at com.redhat.ceylon.compiler.typechecker.tree.Walker.walkCompilationUnit(Walker.java:30)
    at com.redhat.ceylon.compiler.typechecker.tree.Tree$CompilationUnit.visitChildren(Tree.java:30)
    at com.redhat.ceylon.compiler.typechecker.tree.Visitor.visitAny(Visitor.java:24)
    at com.redhat.ceylon.compiler.typechecker.tree.Visitor.visit(Visitor.java:26)
    at com.redhat.ceylon.compiler.typechecker.analyzer.ExpressionVisitor.visit(ExpressionVisitor.java:215)
    at com.redhat.ceylon.compiler.typechecker.tree.Tree$CompilationUnit.visit(Tree.java:22)
    at com.redhat.ceylon.compiler.typechecker.context.PhasedUnit.analyseTypes(PhasedUnit.java:424)
    at org.intellij.plugins.ceylon.ide.ceylonCode.psi.CeylonLocalAnalyzer$31$7.$call$(CeylonLocalAnalyzer.ceylon:558)
    at org.intellij.plugins.ceylon.ide.ceylonCode.psi.CeylonLocalAnalyzer$31.$call$(CeylonLocalAnalyzer.ceylon:566)
    at org.intellij.plugins.ceylon.ide.ceylonCode.psi.CeylonLocalAnalyzer$31.$call$(CeylonLocalAnalyzer.ceylon:524)
    at org.intellij.plugins.ceylon.ide.ceylonCode.model.concurrencyManager_.withIndexStrategy$priv$(concurrencyManager.ceylon:207)
    at org.intellij.plugins.ceylon.ide.ceylonCode.model.concurrencyManager_.withAlternateResolution(concurrencyManager.ceylon:219)
    at org.intellij.plugins.ceylon.ide.ceylonCode.psi.CeylonLocalAnalyzer.createPhasedUnitAndTypecheck$priv$(CeylonLocalAnalyzer.ceylon:524)
    at org.intellij.plugins.ceylon.ide.ceylonCode.psi.CeylonLocalAnalyzer.access$1800(CeylonLocalAnalyzer.ceylon:116)
    at org.intellij.plugins.ceylon.ide.ceylonCode.psi.CeylonLocalAnalyzer$30.$call$(CeylonLocalAnalyzer.ceylon:482)
    at com.redhat.ceylon.ide.common.model.BaseCeylonProject.withSourceModel$canonical$(CeylonProject.ceylon:446)
    at com.redhat.ceylon.ide.common.model.BaseCeylonProject.withSourceModel(CeylonProject.ceylon:438)
    at org.intellij.plugins.ceylon.ide.ceylonCode.psi.CeylonLocalAnalyzer.typecheckSourceFile$priv$(CeylonLocalAnalyzer.ceylon:411)
    at org.intellij.plugins.ceylon.ide.ceylonCode.psi.CeylonLocalAnalyzer.access$1200(CeylonLocalAnalyzer.ceylon:116)
    at org.intellij.plugins.ceylon.ide.ceylonCode.psi.CeylonLocalAnalyzer$13.$call$(CeylonLocalAnalyzer.ceylon:277)
    at org.intellij.plugins.ceylon.ide.ceylonCode.psi.CeylonLocalAnalyzer$9.$call$(CeylonLocalAnalyzer.ceylon:204)
    at ceylon.interop.java.JavaRunnable.run(JavaRunnable.ceylon:7)
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
    at com.intellij.util.Alarm$Request$1.run(Alarm.java:378)
    at com.intellij.util.Alarm$Request.run(Alarm.java:389)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at com.intellij.util.concurrency.SchedulingWrapper$MyScheduledFutureTask.run(SchedulingWrapper.java:227)
    at com.intellij.util.concurrency.BoundedTaskExecutor$2.run(BoundedTaskExecutor.java:187)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

@bjansen
Copy link
Contributor

bjansen commented Sep 21, 2016

Does your IDE really hang, or are you just seeing logs that mention possible locks?

@FroMage
Copy link
Contributor Author

FroMage commented Sep 21, 2016

Completely dead ide

@bjansen bjansen self-assigned this Sep 23, 2016
@bjansen
Copy link
Contributor

bjansen commented Sep 23, 2016

@davidfestal I'm not really sure how to fix this one. updateIndexIfnecessary calls resetJavaModelSourceIfNecessary, which holds a lock on the global model while it's calling DumbService to reindex what's needed.

callWithLock and invokeAndWait are not compatible, and I think we really should wait for the indexation to finish. Which leaves me with this question "do we really need to lock the model while doing this?".

@davidfestal
Copy link

I'll have a look at it next week. Please assign it to me.

@bjansen
Copy link
Contributor

bjansen commented Sep 23, 2016

OK, thanks.

@bjansen bjansen assigned davidfestal and unassigned bjansen Sep 23, 2016
@davidfestal
Copy link

I'm not sure we should update the index while under the "use alternate" indexing strategy.

bjansen pushed a commit that referenced this issue Sep 26, 2016
@FroMage
Copy link
Contributor Author

FroMage commented Sep 30, 2016

Confirmed!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants