Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 #412

Open
bobaikato opened this issue Jun 21, 2022 · 4 comments

Comments

@bobaikato
Copy link

I only have the CTRL + SHIFT + S enabled, so I wonder why this error comes up multiple times without me using the command.

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:634)
	at com.intellij.refactoring.RefactoringImpl.run(RefactoringImpl.java:73)
	at com.siyeh.ig.performance.MethodMayBeStaticInspection$1.doFix(MethodMayBeStaticInspection.java:66)
	at com.siyeh.ig.InspectionGadgetsFix.applyFix(InspectionGadgetsFix.java:39)
	at com.siyeh.ig.InspectionGadgetsFix.applyFix(InspectionGadgetsFix.java:26)
	at com.dubreuia.processors.java.InspectionRunnable.writeQuickFixes(InspectionRunnable.java:96)
	at com.dubreuia.processors.java.InspectionRunnable.run(InspectionRunnable.java:71)
	at com.dubreuia.processors.SaveWriteCommand.lambda$execute$0(SaveWriteCommand.java:53)
	at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.lambda$doRunWriteCommandAction$1(WriteCommandAction.java:150)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1015)
	at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.lambda$doRunWriteCommandAction$2(WriteCommandAction.java:148)
	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:157)
	at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.run(WriteCommandAction.java:124)
	at com.dubreuia.processors.SaveWriteCommand.execute(SaveWriteCommand.java:53)
	at com.dubreuia.core.component.Engine.lambda$processPsiFiles$5(Engine.java:106)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
	at java.base/java.util.stream.ReferencePipeline$11$1.accept(ReferencePipeline.java:442)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
	at com.dubreuia.core.component.Engine.processPsiFiles(Engine.java:107)
	at com.dubreuia.core.component.Engine.processPsiFilesIfNecessary(Engine.java:90)
	at com.dubreuia.core.component.SaveActionManager.guardedProcessPsiFiles(SaveActionManager.java:169)
	at com.dubreuia.core.action.ShortcutAction.actionPerformed(ShortcutAction.java:58)
	at com.intellij.openapi.keymap.impl.ActionProcessor.performAction(ActionProcessor.java:65)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$1.performAction(IdeKeyEventDispatcher.java:579)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.lambda$doPerformActionInner$10(IdeKeyEventDispatcher.java:704)
	at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:106)
	at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:95)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.lambda$doPerformActionInner$11(IdeKeyEventDispatcher.java:704)
	at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareWithCallbacks(ActionUtil.java:256)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.doPerformActionInner(IdeKeyEventDispatcher.java:701)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:645)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:590)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processActionOrWaitSecondStroke(IdeKeyEventDispatcher.java:473)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.inInitState(IdeKeyEventDispatcher.java:462)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:227)
	at com.intellij.ide.IdeEventQueue.dispatchKeyEvent(IdeEventQueue.java:804)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:740)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:439)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:803)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:438)
	at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:119)
	at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:604)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:436)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:873)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:484)
	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)

What triggered the plugin
popup randomly here.

Versions
2.3.0

@fishermans
Copy link
Contributor

Hi @B0BAI

Please see "Help -> Tail log in console" to get more information about Save Action. Save Action is triggered by save event - properly Auto Save - and decides by configuration for each open project if reformatting is enabled for the specified project. Hence, save action is called each time a file is going to be saved even if reformat on save is unchecked.

Regards

@bobaikato
Copy link
Author

From the report, I made mentioned that I only have the Activate action on shortcut CTRL SHIFT S. Why is the auto action active when that's not activated?

@fishermans
Copy link
Contributor

Auto save is triggered by IDEA itself, not by Save Actions. But Save Actions has to evaluate for each file if it is part of an open project having "Activate Save Actions on Save" enabled. It will not process any action but it's been called to find out, if it should invoke any action.

@KnoxasKing
Copy link

As @fishermans said, unfortunately this plugin has been abandoned and therefore is incompatible with new versions of the Jetbrains IDEs.

In alternative you can use this fork:

https://plugins.jetbrains.com/plugin/21538-save-actions-tool
https://github.com/wanghuan9/intellij-plugin-save-action-tool
But for more information check the thread: #427

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants