"PSI invalidated outside transaction" message with stacktrace in idea.log on XmlTagValue.setValue call
已回答
Since IDEA 2020.1 we have "PSI invalidated outside transaction" message in idea.log after calling XmlTagValue.setValue. Though this call is wrapped inside WriteCommandAction.
As I can see in the source code, the com.intellij.psi.impl.source.xml.XmlTextImpl#doSetValue method implementation was changed. In the 2019.3 the modifications were wrapped into the PomModel.runTransaction, in 2020.1 they are not.
2020-04-15 15:58:27,631 [ 106669] INFO - om.intellij.psi.impl.DebugUtil - PSI invalidated outside transaction
java.lang.Throwable
at com.intellij.psi.impl.DebugUtil.currentInvalidationTrace(DebugUtil.java:619)
at com.intellij.psi.impl.DebugUtil.calcInvalidationTrace(DebugUtil.java:612)
at com.intellij.psi.impl.DebugUtil.onInvalidated(DebugUtil.java:583)
at com.intellij.psi.impl.source.tree.TreeElement.onInvalidated(TreeElement.java:226)
at com.intellij.psi.impl.source.tree.TreeElement.rawRemoveUpToWithoutNotifications(TreeElement.java:388)
at com.intellij.psi.impl.source.tree.TreeElement.rawRemoveUpTo(TreeElement.java:342)
at com.intellij.psi.impl.source.tree.TreeElement.rawRemoveUpToLast(TreeElement.java:335)
at com.intellij.psi.impl.source.xml.behavior.DefaultXmlPsiPolicy.encodeXmlTextContents(DefaultXmlPsiPolicy.java:58)
at com.intellij.psi.impl.source.xml.behavior.CDATAOnAnyEncodedPolicy.encodeXmlTextContents(CDATAOnAnyEncodedPolicy.java:42)
at com.intellij.psi.impl.source.xml.XmlTextImpl.doSetValue(XmlTextImpl.java:175)
at com.intellij.psi.impl.source.xml.XmlTextImpl.setValue(XmlTextImpl.java:171)
at com.intellij.psi.impl.source.xml.XmlTagValueImpl.setText(XmlTagValueImpl.java:133)
at com.intellij.psi.impl.source.xml.XmlTagValueImpl.setText(XmlTagValueImpl.java:108)
at com.haulmont.studio.backend.pm.ProjectWriter.modifyComponentIdInWebXml(ProjectWriter.java:779)
at com.haulmont.studio.backend.pm.ProjectWriter.updateAppComponents(ProjectWriter.java:755)
at com.haulmont.studio.backend.pm.ProjectWriter.updateAppComponents(ProjectWriter.java:524)
at com.haulmont.studio.backend.pm.ProjectWriter.lambda$doProjectChanged$1(ProjectWriter.java:249)
at com.intellij.openapi.command.WriteCommandAction$BuilderImpl$2.run(WriteCommandAction.java:117)
at com.intellij.openapi.application.RunResult.run(RunResult.java:35)
at com.intellij.openapi.command.WriteCommandAction.lambda$null$1(WriteCommandAction.java:248)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:976)
at com.intellij.openapi.command.WriteCommandAction.lambda$performWriteCommandAction$2(WriteCommandAction.java:247)
at com.intellij.openapi.command.WriteCommandAction.lambda$doExecuteCommand$4(WriteCommandAction.java:305)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:220)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:188)
at com.intellij.openapi.command.WriteCommandAction.doExecuteCommand(WriteCommandAction.java:307)
at com.intellij.openapi.command.WriteCommandAction.performWriteCommandAction(WriteCommandAction.java:246)
at com.intellij.openapi.command.WriteCommandAction.lambda$execute$0(WriteCommandAction.java:231)
at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:201)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:831)
at com.intellij.openapi.application.impl.ApplicationImpl.lambda$invokeAndWait$8(ApplicationImpl.java:480)
at com.intellij.openapi.application.impl.LaterInvocator$1.run(LaterInvocator.java:124)
at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:80)
at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:128)
at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:46)
at com.intellij.openapi.application.impl.FlushQueue$FlushNow.run(FlushQueue.java:184)
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:974)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:847)
at com.intellij.ide.IdeEventQueue.lambda$null$8(IdeEventQueue.java:449)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:739)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$9(IdeEventQueue.java:448)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:831)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:496)
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)
Do we need to modify our code and wrap this setValue calls somehow, or it is just a defect in IDEA?
请先登录再写评论。
Could you please post the surrounding code/method block?
Sure
But there is nothing interesting here:
In what context is that called? Action? Quickfix?
I would say it is action
It's a defect in the IDE, thanks for reporting! I've filed this as https://youtrack.jetbrains.com/issue/IDEA-241742 which you may follow.