leinardi / mypy-pycharm

A plugin providing both real-time and on-demand scanning of Python files with Mypy from within PyCharm/IDEA.
Apache License 2.0
194 stars 31 forks source link

ProcessCanceledException while scanning file #85

Open intgr opened 2 years ago

intgr commented 2 years ago

Step 1: Are you in the right place?

Step 2: Describe your environment

Step 3: Describe the problem:

I just wanted to document for now; I didn't even notice when this happened, but saw this exception in Event Log.

This is probably a new issue introduced in 0.12. Looks like a race condition, IntelliJ can throw ProcessCanceledException earlier before our current exception handler. So should probably move the exception handler

15.12.2021
10:44   Unexpected Exception Caught
The scan failed due to an exception: An error occurred while scanning a file.
Root cause:
null
com.intellij.openapi.progress.ProcessCanceledException
at com.intellij.openapi.application.impl.ReadMostlyRWLock.startRead(ReadMostlyRWLock.java:108)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:837)
at com.leinardi.pycharm.mypy.checker.ScanFiles.scan(ScanFiles.java:121)
at com.leinardi.pycharm.mypy.checker.ScanFiles.checkFiles(ScanFiles.java:100)
at com.leinardi.pycharm.mypy.checker.ScanFiles.call(ScanFiles.java:74)
at com.leinardi.pycharm.mypy.MypyAnnotator.doAnnotate(MypyAnnotator.java:131)
at com.leinardi.pycharm.mypy.MypyAnnotator.doAnnotate(MypyAnnotator.java:62)
at com.intellij.codeInsight.daemon.impl.ExternalToolPass.doAnnotate(ExternalToolPass.java:218)
at com.intellij.codeInsight.daemon.impl.ExternalToolPass.doAnnotate(ExternalToolPass.java:212)
at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.lambda$run$0(ExternalToolPass.java:190)
at com.intellij.codeInsight.daemon.impl.ExternalToolPass.runChangeAware(ExternalToolPass.java:287)
at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.lambda$run$2(ExternalToolPass.java:190)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:188)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:624)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:698)
at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:646)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:623)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:66)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:175)
at com.intellij.openapi.progress.util.BackgroundTaskUtil.runUnderDisposeAwareIndicator(BackgroundTaskUtil.java:277)
at com.intellij.openapi.progress.util.BackgroundTaskUtil.runUnderDisposeAwareIndicator(BackgroundTaskUtil.java:255)
at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.run(ExternalToolPass.java:189)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:333)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:323)
at com.intellij.util.ui.update.MergingUpdateQueue.lambda$flush$1(MergingUpdateQueue.java:273)
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:287)
at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:241)
at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:240)
at com.intellij.util.Alarm$Request.runSafely(Alarm.java:385)
at com.intellij.util.Alarm$Request.run(Alarm.java:374)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at com.intellij.util.concurrency.SchedulingWrapper$MyScheduledFutureTask.run(SchedulingWrapper.java:220)
at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:246)
at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:32)
at com.intellij.util.concurrency.BoundedTaskExecutor$1.execute(BoundedTaskExecutor.java:225)
at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:213)
at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:214)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
at java.base/java.lang.Thread.run(Thread.java:829)
curtisforrester commented 2 years ago

I seem to get a similar error repeatedly. While in the editor, I do see "live" warnings within code generally. But, I suspect that this is a contributing cause of the recent PyCharm crashes that I'm seeing (never saw them before) and the out of memory errors. I guess I'll disable the plug-in for now until I can see some activity here.

FYI: I'm on PyCharm 2021.1 with MyPy 0.942 and mypy-extensions 0.4.3.

12:17 PM    Unexpected Exception Caught
    The scan failed due to an exception: An error occurred while scanning a file.
    Root cause:
    null
    com.intellij.openapi.progress.ProcessCanceledException
    at com.intellij.openapi.progress.EmptyProgressIndicator.checkCanceled(EmptyProgressIndicator.java:85)
    at com.intellij.openapi.progress.impl.CoreProgressManager.doCheckCanceled(CoreProgressManager.java:133)
    at com.intellij.openapi.progress.ProgressManager.checkCanceled(ProgressManager.java:230)
    at com.intellij.openapi.application.impl.ReadMostlyRWLock.readLock(ReadMostlyRWLock.java:123)
    at com.intellij.openapi.application.impl.ApplicationImpl.acquireReadLock(ApplicationImpl.java:856)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:817)
    at com.leinardi.pycharm.mypy.checker.ScanFiles.scan(ScanFiles.java:121)
    at com.leinardi.pycharm.mypy.checker.ScanFile... (show balloon)

I blame Java haha.