koxudaxi / poetry-pycharm-plugin

A PyCharm plugin for poetry
https://koxudaxi.github.io/poetry-pycharm-plugin/
Apache License 2.0
180 stars 14 forks source link

IDE Fatal Error after git pull. #296

Open makix222 opened 2 years ago

makix222 commented 2 years ago

Setup:

I am on Poetry 1.1.5-212

the moment the git pull completed, an IDE Fatal Errors dialog box appeared with the following message:

Error Log ProcessCanceledException must not be thrown from document listeners for real document java.lang.Throwable: com.intellij.openapi.progress.ProcessCanceledException: com.intellij.serviceContainer.AlreadyDisposedException: Cannot create com.intellij.openapi.roots.ProjectFileIndex because container is already disposed (container=Project(name=projdm, containerState=DISPOSE_COMPLETED, componentStore=/home/emerson/projdm) (disposed)) at com.intellij.openapi.editor.impl.DocumentImpl$DelayedExceptions.register(DocumentImpl.java:840) at com.intellij.openapi.editor.impl.DocumentImpl.changedUpdate(DocumentImpl.java:916) at com.intellij.openapi.editor.impl.DocumentImpl.updateText(DocumentImpl.java:817) at com.intellij.openapi.editor.impl.DocumentImpl.replaceString(DocumentImpl.java:658) at com.intellij.openapi.editor.impl.DocumentImpl.replaceText(DocumentImpl.java:527) at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl$3.run(FileDocumentManagerImpl.java:712) at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:936) at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.lambda$reloadFromDisk$6(FileDocumentManagerImpl.java:698) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:216) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:172) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:162) at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.reloadFromDisk(FileDocumentManagerImpl.java:698) at com.jetbrains.rdserver.document.BackendFileDocumentManager.reloadFromDisk(BackendFileDocumentManager.kt:11) at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.contentsChanged(FileDocumentManagerImpl.java:678) at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl$MyAsyncFileListener$1.afterVfsChange(FileDocumentManagerImpl.java:618) at com.intellij.openapi.vfs.newvfs.AsyncEventSupport.afterVfsChange(AsyncEventSupport.java:139) at com.intellij.openapi.vfs.newvfs.AsyncEventSupport.processEventsFromRefresh(AsyncEventSupport.java:159) at com.intellij.openapi.vfs.newvfs.RefreshSessionImpl.fireEventsInWriteAction(RefreshSessionImpl.java:227) at com.intellij.openapi.vfs.newvfs.RefreshSessionImpl.lambda$fireEvents$1(RefreshSessionImpl.java:205) at com.intellij.openapi.application.impl.ApplicationImpl.lambda$runEdtProgressWriteAction$11(ApplicationImpl.java:900) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:183) at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:705) at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:647) at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:63) at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:170) at com.intellij.openapi.progress.util.PotemkinProgress.runInSwingThread(PotemkinProgress.java:197) at com.intellij.openapi.application.impl.ApplicationImpl.lambda$runEdtProgressWriteAction$12(ApplicationImpl.java:900) at com.intellij.openapi.application.impl.ApplicationImpl.runWriteActionWithClass(ApplicationImpl.java:924) at com.intellij.openapi.application.impl.ApplicationImpl.runEdtProgressWriteAction(ApplicationImpl.java:898) at com.intellij.openapi.application.impl.ApplicationImpl.runWriteActionWithNonCancellableProgressInDispatchThread(ApplicationImpl.java:879) at com.intellij.openapi.vfs.newvfs.RefreshSessionImpl.lambda$fireEvents$2(RefreshSessionImpl.java:199) at com.intellij.openapi.application.WriteAction.lambda$run$1(WriteAction.java:94) at com.intellij.openapi.application.impl.ApplicationImpl.runWriteActionWithClass(ApplicationImpl.java:924) at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:950) at com.intellij.openapi.application.WriteAction.run(WriteAction.java:93) at com.intellij.openapi.vfs.newvfs.RefreshSessionImpl.fireEvents(RefreshSessionImpl.java:198) at com.intellij.openapi.vfs.newvfs.RefreshQueueImpl.lambda$runAsyncListeners$9(RefreshQueueImpl.java:154) at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.lambda$safeTransferToEdt$6(NonBlockingReadActionImpl.java:577) at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:214) at com.intellij.openapi.application.TransactionGuardImpl.access$200(TransactionGuardImpl.java:21) at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:196) at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:794) at com.intellij.openapi.application.impl.ApplicationImpl.lambda$invokeLater$4(ApplicationImpl.java:350) at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:84) at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:133) at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:46) at com.intellij.openapi.application.impl.FlushQueue$FlushNow.run(FlushQueue.java:189) at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746) at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:885) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:754) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:441) at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:825) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:440) at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:794) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:486) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90) Caused by: com.intellij.openapi.progress.ProcessCanceledException: com.intellij.serviceContainer.AlreadyDisposedException: Cannot create com.intellij.openapi.roots.ProjectFileIndex because container is already disposed (container=Project(name=projdm, containerState=DISPOSE_COMPLETED, componentStore=/home/emerson/projdm) (disposed)) at com.intellij.serviceContainer.ContainerUtilKt.throwAlreadyDisposedError(containerUtil.kt:48) at com.intellij.serviceContainer.ComponentManagerImpl.doGetService(ComponentManagerImpl.kt:612) at com.intellij.serviceContainer.ComponentManagerImpl.getService(ComponentManagerImpl.kt:573) at com.intellij.openapi.client.ClientAwareComponentManager.getFromSelfOrCurrentSession(ClientAwareComponentManager.kt:37) at com.intellij.openapi.client.ClientAwareComponentManager.getService(ClientAwareComponentManager.kt:22) at com.intellij.openapi.roots.ProjectFileIndex.getInstance(ProjectFileIndex.java:31) at com.intellij.openapi.module.ModuleUtilCore.findModuleForFile(ModuleUtilCore.java:72) at com.koxudaxi.poetry.PoetryKt.getModule(poetry.kt:517) at com.koxudaxi.poetry.PoetryKt.access$getModule(poetry.kt:1) at com.koxudaxi.poetry.PyProjectTomlWatcher$editorCreated$listener$1.documentChanged(poetry.kt:446) at com.intellij.openapi.editor.impl.DocumentImpl.changedUpdate(DocumentImpl.java:913) ... 65 more Caused by: com.intellij.serviceContainer.AlreadyDisposedException: Cannot create com.intellij.openapi.roots.ProjectFileIndex because container is already disposed (container=Project(name=projdm, containerState=DISPOSE_COMPLETED, componentStore=/home/emerson/projdm) (disposed)) at com.intellij.serviceContainer.ContainerUtilKt.throwAlreadyDisposedError(containerUtil.kt:43) ... 75 more
koxudaxi commented 2 years ago

@makix222 Thank you for creating this issue. nice catch!! We have to handle the exception.

Btw, This plugin is moving on PyCharm mainstream. PyCharm 2021.3 EAP includes this poetry plugin code.

Also, The feature should be supported by JetBrains. https://youtrack.jetbrains.com/issue/PY-30702#focus=Comments-27-5323626.0-0

Would you please create the issue in youtrack?