xdev-software/intellij-plugin-save-actions

Refactorings should not be started inside write action because they start progress inside and any read action from the progress task would cause the deadlock

kyxap opened this issue · 8 comments

kyxap commented

Hi there!
Got this issue after 10 min of trying this fork.

  Refactorings should not be started inside write action
because they start progress inside and any read action from the progress task would cause the deadlock
  
  java.lang.Exception
at com.intellij.refactoring.BaseRefactoringProcessor.run(BaseRefactoringProcessor.java:636)
at com.intellij.refactoring.RefactoringImpl.run(RefactoringImpl.java:56)
at com.siyeh.ig.performance.MethodMayBeStaticInspection$1.doFix(MethodMayBeStaticInspection.java:67)
at com.siyeh.ig.InspectionGadgetsFix.applyFix(InspectionGadgetsFix.java:39)
at com.siyeh.ig.InspectionGadgetsFix.applyFix(InspectionGadgetsFix.java:26)
at software.xdev.saveactions.processors.java.InspectionRunnable.writeQuickFixes(InspectionRunnable.java:78)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at software.xdev.saveactions.processors.java.InspectionRunnable.lambda$run$0(InspectionRunnable.java:47)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at software.xdev.saveactions.processors.java.InspectionRunnable.run(InspectionRunnable.java:47)
at software.xdev.saveactions.processors.SaveWriteCommand.lambda$execute$0(SaveWriteCommand.java:27)
at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.lambda$doRunWriteCommandAction$1(WriteCommandAction.java:149)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:992)
at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.lambda$doRunWriteCommandAction$2(WriteCommandAction.java:147)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:219)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:184)
at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.doRunWriteCommandAction(WriteCommandAction.java:156)
at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.run(WriteCommandAction.java:123)
at software.xdev.saveactions.processors.SaveWriteCommand.execute(SaveWriteCommand.java:27)
at software.xdev.saveactions.core.component.Engine.lambda$processPsiFiles$6(Engine.java:94)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at java.base/java.util.stream.ReferencePipeline$15$1.accept(ReferencePipeline.java:541)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
at java.base/java.util.AbstractList$RandomAccessSpliterator.forEachRemaining(AbstractList.java:720)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575)
at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616)
at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622)
at java.base/java.util.stream.ReferencePipeline.toList(ReferencePipeline.java:627)
at software.xdev.saveactions.core.component.Engine.processPsiFiles(Engine.java:95)
at software.xdev.saveactions.core.component.Engine.processPsiFilesIfNecessary(Engine.java:73)
at software.xdev.saveactions.core.service.impl.AbstractSaveActionsService.guardedProcessPsiFiles(AbstractSaveActionsService.java:68)
at software.xdev.saveactions.core.service.impl.SaveActionsJavaService.guardedProcessPsiFiles(SaveActionsJavaService.java:22)
at software.xdev.saveactions.core.action.ShortcutAction.actionPerformed(ShortcutAction.java:37)
at com.intellij.openapi.actionSystem.ex.ActionUtil.doPerformActionOrShowPopup(ActionUtil.java:339)
at com.intellij.openapi.keymap.impl.ActionProcessor.performAction(ActionProcessor.java:47)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$myActionProcessor$1.performAction(IdeKeyEventDispatcher.kt:502)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcherKt.doPerformActionInner$lambda$5$lambda$4(IdeKeyEventDispatcher.kt:865)
at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:105)
at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:94)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcherKt.doPerformActionInner$lambda$5(IdeKeyEventDispatcher.kt:865)
at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareWithCallbacks(ActionUtil.java:362)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcherKt.doPerformActionInner(IdeKeyEventDispatcher.kt:863)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcherKt.access$doPerformActionInner(IdeKeyEventDispatcher.kt:1)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction$intellij_platform_ide_impl(IdeKeyEventDispatcher.kt:587)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.kt:513)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processActionOrWaitSecondStroke(IdeKeyEventDispatcher.kt:454)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.inInitState(IdeKeyEventDispatcher.kt:447)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.kt:309)
at com.intellij.ide.IdeEventQueue.dispatchKeyEvent(IdeEventQueue.kt:617)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:587)
at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:67)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:369)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:368)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:787)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:368)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:363)
at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:992)
at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:113)
at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:992)
at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$7(IdeEventQueue.kt:363)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:861)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:405)
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)
IntelliJ IDEA 2023.2.2 (Ultimate Edition)
Build #IU-232.9921.47, built on September 12, 2023
Licensed to <REMOVED>
Expiration date: October 21, 2023
Runtime version: 17.0.8+7-b1000.22 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 14.0
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 10
Metal Rendering is ON
Registry:
    ide.experimental.ui=true

Non-Bundled Plugins:
    software.xdev.saveactions (1.0.4)
    com.intellij.java.rareRefactorings (232.8660.142)
    com.sourcegraph.jetbrains (3.0.9)
    com.intellij.lang.jsgraphql (4.0.2)
    org.intellij.plugins.hcl (232.8660.88)
    org.intellij.scala (2023.2.22)
    Pythonid (232.8660.185)

Kotlin: 232-1.9.0-IJ9921.47
Apple M1 Max
Sonama

upd:

How is the plugin configured (it's best to shared .idea/saveactions_settings.xml)

image I do not have `saveactions_settings.xml` in idea after setting this config again

What you did before the bug happend (e.g. created new file, clicked save, etc)

I continue to happen in two situations:

  • hot key used
  • project opened after some time of not using it, for example in my current project I do not have or settings was remove because:
cat: .idea/saveactions_settings.xml: No such file or directory

Hi @kyxap,

thank you for the issue.
Could you please share details how this can be reproduced? E.g.

  • How is the plugin configured (it's best to shared .idea/saveactions_settings.xml)
  • What you did before the bug happend (e.g. created new file, clicked save, etc)

No feedback since 2 weeks. Closing

kyxap commented

hey @AB-xdev please see UPD in my original post.
Thanks

So I tried your configuration and however I can still not reproduce the problem. Could you maybe share the code where the problem occurs or create a example project on GitHub?

The problem might also be related to the installed plugins. Does the problem occur when you disable all plugins except Save Actions?

kyxap commented

nope all works as expected when plugin is disabled

nope all works as expected when plugin is disabled

That's not what I asked for above. Please read again ;)

kyxap commented

anyway, it seems like your fork works same as original plugin (it just does not) it could be related to some plugins or tool that I have on my end but I can't share them at this moment.