Read Access error when unshelving changes
johnthagen opened this issue · 3 comments
johnthagen commented
Describe the bug
When unshelving changes using the PyCharm shelf feature, if the changes modify a Python file, I sometimes get an unhandled exception in the Ruff plugin:
com.intellij.openapi.diagnostic.RuntimeExceptionWithAttachments: Read access is allowed from inside read-action (see Application.runReadAction()); see https://jb.gg/ij-platform-threading for details
Current thread: Thread[ApplicationImpl pooled thread 162,4,main] 887693740 (EventQueue.isDispatchThread()=false)
SystemEventQueueThread: Thread[AWT-EventQueue-0,6,main] 169213168
at com.intellij.util.concurrency.ThreadingAssertions.createThreadAccessException(ThreadingAssertions.java:149)
at com.intellij.util.concurrency.ThreadingAssertions.softAssertReadAccess(ThreadingAssertions.java:107)
at com.intellij.openapi.application.impl.ApplicationImpl.assertReadAccessAllowed(ApplicationImpl.java:1012)
at com.intellij.openapi.fileEditor.impl.FileDocumentManagerBase.getDocument(FileDocumentManagerBase.java:47)
at com.intellij.openapi.fileEditor.FileDocumentManager.getDocument(FileDocumentManager.java:61)
at com.intellij.psi.AbstractFileViewProvider.getDocument(AbstractFileViewProvider.java:170)
at com.intellij.psi.AbstractFileViewProvider$VirtualFileContent.getText(AbstractFileViewProvider.java:446)
at com.intellij.psi.AbstractFileViewProvider.getContents(AbstractFileViewProvider.java:151)
at com.intellij.psi.impl.source.PsiFileImpl.getText(PsiFileImpl.java:307)
at com.koxudaxi.ruff.SourceFile$text$2.invoke(Ruff.kt:269)
at com.koxudaxi.ruff.SourceFile$text$2.invoke(Ruff.kt:269)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at com.koxudaxi.ruff.SourceFile.getText(Ruff.kt:269)
at com.koxudaxi.ruff.SourceFile.getAsStdin(Ruff.kt:274)
at com.koxudaxi.ruff.RuffKt.generateCommandArgs(Ruff.kt:297)
at com.koxudaxi.ruff.RuffKt.runRuff(Ruff.kt:282)
at com.koxudaxi.ruff.RuffApplyService.apply$lambda$2(RuffApplyService.kt:48)
at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:249)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
at java.base/java.lang.Thread.run(Thread.java:840)
Expected behavior
No unhandled exceptions when using Ruff PyCharm plugin.
Environments:
- IDE: PyCharm Professional 2023.3.2
- OS: macOS 13.6.1
- Ruff Version: 0.1.10
- Plugin version: 0.0.28
koxudaxi commented
Thank you for creating the issue.
I didn't test the plugin for the unshelving changes feature.
I will fix it.
koxudaxi commented
@johnthagen
I have released fixed version 0.0.29
Thank you very much!!
johnthagen commented
Thanks @koxudaxi!