rikvdkleij / intellij-haskell

IntelliJ plugin for Haskell
https://rikvdkleij.github.io/intellij-haskell/
Apache License 2.0
1.31k stars 94 forks source link

"Update settings" in a big project causes "Scanning files to index" stuck forever #362

Closed develop7 closed 5 years ago

develop7 commented 5 years ago

Repro:

Expected: it finishes in about same time it was upon opening the project (a minute maybe).

Instead: it is stuck for tens of minutes, haven't seen it finished without user interaction.

Closing project in that state produces following (maybe unrelated) exception:

stacktrace ``` java.lang.AssertionError: Already disposed: Project (Disposed) [REDACTED] at com.intellij.openapi.components.impl.ComponentManagerImpl.lambda$throwAlreadyDisposed$1(ComponentManagerImpl.java:245) at com.intellij.openapi.application.ReadAction.lambda$run$1(ReadAction.java:53) at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:977) at com.intellij.openapi.application.ReadAction.compute(ReadAction.java:57) at com.intellij.openapi.application.ReadAction.run(ReadAction.java:53) at com.intellij.openapi.components.impl.ComponentManagerImpl.throwAlreadyDisposed(ComponentManagerImpl.java:243) at com.intellij.openapi.components.impl.ComponentManagerImpl.getPicoContainer(ComponentManagerImpl.java:236) at com.intellij.openapi.components.impl.ComponentManagerImpl.getPicoContainer(ComponentManagerImpl.java:46) at com.intellij.openapi.components.ServiceManager.doGetService(ServiceManager.java:47) at com.intellij.openapi.components.ServiceManager.getService(ServiceManager.java:30) at com.intellij.openapi.roots.impl.libraries.ProjectLibraryTable.getInstance(ProjectLibraryTable.java:10) at com.intellij.openapi.roots.impl.libraries.LibraryTablesRegistrarImpl.getLibraryTable(LibraryTablesRegistrarImpl.java:41) at com.intellij.openapi.roots.impl.libraries.LibraryTablesRegistrarImpl.getLibraryTableByLevel(LibraryTablesRegistrarImpl.java:46) at com.intellij.openapi.roots.impl.LibraryOrderEntryImpl.dispose(LibraryOrderEntryImpl.java:235) at com.intellij.openapi.util.Disposer$1.execute(Disposer.java:48) at com.intellij.openapi.util.Disposer$1.execute(Disposer.java:44) at com.intellij.openapi.util.objectTree.ObjectTree.executeActionWithRecursiveGuard(ObjectTree.java:182) at com.intellij.openapi.util.objectTree.ObjectTree.executeUnregistered(ObjectTree.java:194) at com.intellij.openapi.util.objectTree.ObjectTree.executeAll(ObjectTree.java:147) at com.intellij.openapi.util.Disposer.dispose(Disposer.java:129) at com.intellij.openapi.util.Disposer.dispose(Disposer.java:125) at com.intellij.openapi.CompositeDisposable.dispose(CompositeDisposable.java:45) at com.intellij.openapi.util.Disposer$1.execute(Disposer.java:48) at com.intellij.openapi.util.Disposer$1.execute(Disposer.java:44) at com.intellij.openapi.util.objectTree.ObjectTree.executeActionWithRecursiveGuard(ObjectTree.java:182) at com.intellij.openapi.util.objectTree.ObjectTree.executeUnregistered(ObjectTree.java:194) at com.intellij.openapi.util.objectTree.ObjectTree.executeAll(ObjectTree.java:147) at com.intellij.openapi.util.Disposer.dispose(Disposer.java:129) at com.intellij.openapi.util.Disposer.dispose(Disposer.java:125) at com.intellij.openapi.roots.impl.RootModelImpl.dispose(RootModelImpl.java:656) at com.intellij.openapi.roots.impl.ModuleRootManagerImpl$1.dispose(ModuleRootManagerImpl.java:106) at com.intellij.openapi.roots.ModuleRootModificationUtil.updateModel(ModuleRootModificationUtil.java:148) at intellij.haskell.module.HaskellModuleBuilder$.removeModuleLibrary(HaskellModuleBuilder.scala:335) at intellij.haskell.module.HaskellModuleBuilder$.$anonfun$addPackagesAsDependenciesToModule$1(HaskellModuleBuilder.scala:295) at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:32) at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:29) at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:194) at intellij.haskell.module.HaskellModuleBuilder$.addPackagesAsDependenciesToModule(HaskellModuleBuilder.scala:288) at intellij.haskell.module.HaskellModuleBuilder$.$anonfun$addLibrarySources$6(HaskellModuleBuilder.scala:262) at intellij.haskell.module.HaskellModuleBuilder$.$anonfun$addLibrarySources$6$adapted(HaskellModuleBuilder.scala:261) at scala.collection.mutable.ResizableArray.foreach(ResizableArray.scala:58) at scala.collection.mutable.ResizableArray.foreach$(ResizableArray.scala:51) at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47) at intellij.haskell.module.HaskellModuleBuilder$.$anonfun$addLibrarySources$1(HaskellModuleBuilder.scala:261) at intellij.haskell.module.HaskellModuleBuilder$.$anonfun$addLibrarySources$1$adapted(HaskellModuleBuilder.scala:242) at scala.Option.foreach(Option.scala:257) at intellij.haskell.module.HaskellModuleBuilder$.addLibrarySources(HaskellModuleBuilder.scala:242) at intellij.haskell.external.component.StackProjectManager$$anon$2.$anonfun$run$23(StackProjectManager.scala:206) at intellij.haskell.util.ScalaUtil$$anon$1.run(ScalaUtil.scala:36) at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:314) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) 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) ```
rikvdkleij commented 5 years ago

Yeah, I know this issue. I thought it was fixed by waiting on smart mode before updating module settings. But apparently during updating the module settings also an index job can be started.

I have some change in mind. Hopefully that will solve it.

rikvdkleij commented 5 years ago

Should be fixed in next beta. It still takes some time but at least risk of deadlock should be gone.

rikvdkleij commented 5 years ago

@develop7 Seems to be not solved with my latest changes. Have to find another solution....

rikvdkleij commented 5 years ago

Should be fixed in beta39. I can not reproduce it anymore.

rikvdkleij commented 5 years ago

Is this fixed?

develop7 commented 5 years ago

Nope, just ran into it again. Took a while this time, though.

rikvdkleij commented 5 years ago

Weird, I can not reproduce it anymore.

develop7 commented 5 years ago

OK, it seems to gets unstuck eventually. I'll close it and would reopen later should I run into this issue again.