JetBrains / idea-gitignore

.ignore support plugin for IntelliJ IDEA
Apache License 2.0
1.29k stars 176 forks source link

Slow operations are prohibited on EDT #831

Closed ArtManyak closed 1 year ago

ArtManyak commented 1 year ago

Prerequisites

Description

We are observed a lot of exceptions in Rider 232 EAP 2

java.lang.Throwable: Slow operations are prohibited on EDT. See SlowOperations.assertSlowOperationsAreAllowed javadoc.
    at com.intellij.openapi.diagnostic.Logger.error(Logger.java:367)
    at com.intellij.util.SlowOperations.assertSlowOperationsAreAllowed(SlowOperations.java:129)
    at com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexDataImpl.ensureIsUpToDate(WorkspaceFileIndexDataImpl.kt:129)
    at com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexDataImpl.getFileInfo(WorkspaceFileIndexDataImpl.kt:75)
    at com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexImpl.getFileInfo(WorkspaceFileIndexImpl.kt:220)
    at com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexImpl.findFileSetWithCustomData(WorkspaceFileIndexImpl.kt:205)
    at com.intellij.openapi.roots.impl.ProjectFileIndexImpl.getContentRootForFile(ProjectFileIndexImpl.java:138)
    at com.intellij.openapi.roots.impl.ProjectFileIndexImpl.getContentRootForFile(ProjectFileIndexImpl.java:132)
    at com.intellij.openapi.module.impl.scopes.ModuleWithDependenciesScope.contains(ModuleWithDependenciesScope.java:167)
    at mobi.hsz.idea.gitignore.util.Utils.getModuleForFile(Utils.kt:103)
    at mobi.hsz.idea.gitignore.util.Utils.isInProject(Utils.kt:117)
    at mobi.hsz.idea.gitignore.IgnoreManager.isFileIgnored(IgnoreManager.kt:136)
    at mobi.hsz.idea.gitignore.daemon.IgnoredEditingNotificationProvider.createNotificationPanel(IgnoredEditingNotificationProvider.kt:38)
    at mobi.hsz.idea.gitignore.daemon.IgnoredEditingNotificationProvider.collectNotificationData$lambda$1(IgnoredEditingNotificationProvider.kt:46)
    at com.intellij.ui.EditorNotificationsImpl$updateEditors$job$1$2.invokeSuspend(EditorNotificationsImpl.kt:218)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:194)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:873)
    at com.intellij.openapi.application.impl.ApplicationImpl$4.run(ApplicationImpl.java:490)
    at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:79)
    at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:122)
    at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:41)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:789)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:740)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:734)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:759)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:664)
    at com.intellij.ide.IdeEventQueue._dispatchEvent$lambda$8(IdeEventQueue.kt:568)
    at com.intellij.openapi.application.impl.ApplicationImpl.withoutImplicitRead(ApplicationImpl.java:1515)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:568)
    at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:68)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:348)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:347)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:791)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:347)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:342)
    at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:993)
    at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:105)
    at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:993)
    at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$5(IdeEventQueue.kt:342)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:873)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:384)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)

Additional Information

It looks like check for EDT.isCurrentThreadEdt() in https://github.com/JetBrains/idea-gitignore/blob/main/src/main/kotlin/mobi/hsz/idea/gitignore/IgnoreManager.kt should be moved earlier than Utils.isInProject to avoid an issue

gregsh commented 1 year ago

https://jb-web.exa.aws.intellij.net/issue/831270 IgnoredEditingNotificationProvider

https://jb-web.exa.aws.intellij.net/issue/833575 MissingGitignoreNotificationProvider

van800 commented 1 year ago

There is also related exception https://youtrack.jetbrains.com/issue/DEXP-696024/Cannot-create-com.intellij.openapi.vcs.FileStatusManager-because-container-is-already-disposed-containerProjectnameDotNext