eclipse-pde-partial-idea
eclipse-pde-partial-idea copied to clipboard
IllegalStateException: Unexpected state that both bridges are not actual
Version 1.6.1, IntelliJ IDEA 2023.1 (Ultimate).
I just opened a Java/Groovy project - my local clone of https://github.com/spockframework/spock - with absolutely no relationship to PDE or OSGi whatsoever for the first time after a few months. I immediately got this error:
java.lang.RuntimeException: java.lang.IllegalStateException: Unexpected state that both bridges are not actual
at com.intellij.openapi.application.impl.LaterInvocator.invokeAndWait(LaterInvocator.java:133)
at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:448)
at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:468)
at com.intellij.openapi.roots.ModuleRootModificationUtil.modifyModel(ModuleRootModificationUtil.java:161)
at com.intellij.openapi.roots.ModuleRootModificationUtil.updateModel(ModuleRootModificationUtil.java:151)
at cn.varsa.idea.pde.partial.plugin.support.ModuleExtKt.updateModel(ModuleExt.kt:15)
at cn.varsa.idea.pde.partial.plugin.resolver.PdeModuleRuntimeLibraryResolver.preResolve(PdeModuleRuntimeLibraryResolver.kt:22)
at cn.varsa.idea.pde.partial.plugin.resolver.PdeModuleRuntimeLibraryResolver.preResolve(PdeModuleRuntimeLibraryResolver.kt:16)
at cn.varsa.idea.pde.partial.plugin.openapi.resolver.PdeLibraryResolverRegistry.callExtensions(PdeLibraryResolverRegistry.kt:61)
at cn.varsa.idea.pde.partial.plugin.openapi.resolver.PdeLibraryResolverRegistry.resolveModule(PdeLibraryResolverRegistry.kt:84)
at cn.varsa.idea.pde.partial.plugin.config.BundleManagementService$onFinished$1$1.resolve(BundleManagementService.kt:134)
at cn.varsa.idea.pde.partial.plugin.support.BackgroundResolvable$backgroundResolve$6.run(BackgroundResolvable.kt:25)
at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:429)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:114)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsynchronously$6(CoreProgressManager.java:480)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:252)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:186)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:604)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:679)
at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:635)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:603)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:173)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:252)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
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:833)
Caused by: java.lang.IllegalStateException: Unexpected state that both bridges are not actual
at com.intellij.workspaceModel.ide.impl.legacyBridge.module.roots.ModifiableModuleLibraryTableBridge.disposeOriginalLibrariesAndUpdateCopies$intellij_platform_projectModel_impl(ModifiableModuleLibraryTableBridge.kt:211)
at com.intellij.workspaceModel.ide.impl.legacyBridge.module.roots.ModifiableRootModelBridgeImpl.postCommit(ModifiableRootModelBridgeImpl.kt:577)
at com.intellij.workspaceModel.ide.impl.legacyBridge.module.roots.ModifiableRootModelBridgeImpl.commit(ModifiableRootModelBridgeImpl.kt:569)
at com.intellij.openapi.application.WriteAction.lambda$run$1(WriteAction.java:87)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteActionWithClass(ApplicationImpl.java:946)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:972)
at com.intellij.openapi.application.WriteAction.run(WriteAction.java:86)
at com.intellij.openapi.roots.ModuleRootModificationUtil.lambda$modifyModel$11(ModuleRootModificationUtil.java:163)
at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:209)
at com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:21)
at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:191)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:831)
at com.intellij.openapi.application.impl.ApplicationImpl$3.run(ApplicationImpl.java:456)
at com.intellij.openapi.application.impl.LaterInvocator$1.run(LaterInvocator.java:101)
at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:79)
at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:122)
at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:41)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:788)
at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739)
at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:731)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:758)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:666)
at com.intellij.ide.IdeEventQueue._dispatchEvent$lambda$7(IdeEventQueue.kt:570)
at com.intellij.openapi.application.impl.ApplicationImpl.withoutImplicitRead(ApplicationImpl.java:1446)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:570)
at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:68)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:349)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:348)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:787)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:348)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:343)
at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:994)
at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:105)
at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:994)
at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$4(IdeEventQueue.kt:343)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:831)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:385)
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)
The same error just occurred in yet another project totally unrelated to Eclipse and OSGi, a Spring Boot playground project. Interestingly, just like with my other project, the error only seems to occur once, i.e. the first time the project is opened after having updated your plugin. I am still wondering, however, how it can occur in the first place, because the plugin should not do anything in those two projects. I think that there is something fundamentally wrong in your plugin design and/or how you use the IntelliJ API, because it really is the only one of my many plugins, in which such errors occur. You fixed some already (or maybe are just catching and discarding exceptions, I don't know), but this one is still occurring.
Yes, according to the design, projects unrelated to OSGi should not trigger the function of the plug-in. I'm still trying to fix this problem, but it has never been reproduced locally.
At present, all code modifications can rely on guessing, which makes frequent modifications but useless.
Would it help you to provide me with a special developer build containing additional logging or so? But actually, I still believe that the stack trace should give you a clue about when and where from the plugin is invoked. I have to take your word for it that it is not enough to fix the problem, even though it is somewhat hard to believe.
I have added some code to record Facet in the log. You can try to run it and provide me with idea.log;
According to the correct logic and theory, under the correct circumstances spock should not have any Facet, and at present, I can't get it wrongly in any way. The existence of Facet also prevents me from correcting this problem.
Plugins link:
Hello. Somehow, I must have missed your message with the zip attachment. Today, after quite a while, it happened again in plugin version 1.6.3, when I was opening a simple AspectJ project.
java.lang.RuntimeException: java.lang.IllegalStateException: Unexpected state that both bridges are not actual
at com.intellij.openapi.application.impl.LaterInvocator.invokeAndWait(LaterInvocator.java:131)
at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:471)
at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:490)
at com.intellij.openapi.roots.ModuleRootModificationUtil.modifyModel(ModuleRootModificationUtil.java:161)
at cn.varsa.idea.pde.partial.plugin.helper.ModuleHelper.setCompileOutputPath(ModuleHelper.kt:49)
at cn.varsa.idea.pde.partial.plugin.helper.ModuleHelper.resetCompileOutputPath(ModuleHelper.kt:33)
at cn.varsa.idea.pde.partial.plugin.config.BundleManagementService$onFinished$1$1.resolve(BundleManagementService.kt:139)
at cn.varsa.idea.pde.partial.plugin.support.BackgroundResolvable$backgroundResolve$6.run(BackgroundResolvable.kt:25)
at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:428)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:115)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsynchronously$6(CoreProgressManager.java:478)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:251)
at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:71)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:186)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:604)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:679)
at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:635)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:603)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:61)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:173)
at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:71)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$5(ProgressRunner.java:251)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$launchTask$18(ProgressRunner.java:465)
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:833)
Caused by: java.lang.IllegalStateException: Unexpected state that both bridges are not actual
at com.intellij.workspaceModel.ide.impl.legacyBridge.module.roots.ModifiableModuleLibraryTableBridge.disposeOriginalLibrariesAndUpdateCopies$intellij_platform_projectModel_impl(ModifiableModuleLibraryTableBridge.kt:208)
at com.intellij.workspaceModel.ide.impl.legacyBridge.module.roots.ModifiableRootModelBridgeImpl.postCommit(ModifiableRootModelBridgeImpl.kt:581)
at com.intellij.workspaceModel.ide.impl.legacyBridge.module.roots.ModifiableRootModelBridgeImpl.commit(ModifiableRootModelBridgeImpl.kt:573)
at com.intellij.openapi.application.WriteAction.lambda$run$1(WriteAction.java:87)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteActionWithClass(ApplicationImpl.java:980)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1006)
at com.intellij.openapi.application.WriteAction.run(WriteAction.java:86)
at com.intellij.openapi.roots.ModuleRootModificationUtil.lambda$modifyModel$11(ModuleRootModificationUtil.java:163)
at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:208)
at com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:21)
at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:190)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:861)
at com.intellij.openapi.application.impl.ApplicationImpl$4.run(ApplicationImpl.java:478)
at com.intellij.openapi.application.impl.LaterInvocator$1.run(LaterInvocator.java:100)
at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:79)
at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:121)
at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:41)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:792)
at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739)
at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:733)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:761)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:685)
at com.intellij.ide.IdeEventQueue._dispatchEvent$lambda$10(IdeEventQueue.kt:589)
at com.intellij.openapi.application.impl.ApplicationImpl.runWithoutImplicitRead(ApplicationImpl.java:1485)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:589)
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:105)
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)
Will I get problems if I downgrade to your older version in the zip, or do you want to rebase your logging to the current version? The thing is, the recent fixes are helpful in other projects, which are really about Eclipse plugins. I am afraid that a downgrade will turn into an impediment there.
In the current version 1.6.3, this log is still retained. You can check the relevant log content in idea.log.
That is good news. I hope that this excerpt from the log at the time it happened is any helpful to you. log.txt
@JaneWardSandy, you seem to be quite busy. Sorry to ask again, but I would like to know if the log contains anything insightful for you.
I'm sorry that I've been occupied by other affairs recently.
This log does not contain content that I can use to analyze. According to the code, the Facet
contained in Module
should be printed into idea.log
, and only the Module
of Eclipse PDE Partial
Facet
will execute the Model
update.
https://github.com/JaneWardSandy/eclipse-pde-partial-idea/blob/a2b51f23cb58173102a88daddeab461a8636e37c/eclipse-pde-partial-idea/src/main/kotlin/cn/varsa/idea/pde/partial/plugin/config/BundleManagementService.kt#L130-L133
https://github.com/JaneWardSandy/eclipse-pde-partial-idea/blob/a2b51f23cb58173102a88daddeab461a8636e37c/eclipse-pde-partial-idea/src/main/kotlin/cn/varsa/idea/pde/partial/plugin/config/BundleManagementService.kt#L139-L141
At present, there is no log support. You can check whether the modules in the project contain Eclipse PDE Partial
Facet
. If so, remove the Facet
.
The projects in question do not contain the Eclipse PDE Partial facet. That is the whole point of the issue at hand and what surprised me so much in the first place. The projects which trigger the problem may contain various other facets, though, such as AspectJ, Kotlin.
~I cannot remember that any projects without any facets triggered it~ Correction: The very project I mentioned when opening this issue, the Spock Framework, does not contain any facets at all. Therefore, it is not related to whether projects contain any facets or not. It can happen for facet-free projects, but also for projects with various other facets. But they all have in common that there is no PDE Partial facet in either of them.
It does not contain any Eclipse PDE Partial facet
but is considered to exist in the code. FacetManager#getFacetByType
does not seem to be particularly reliable.
Temporarily add a workaround: when Locations
in Target
is empty, no relevant code execution will be performed. Hope to temporarily solve the current error problem.
https://github.com/JaneWardSandy/eclipse-pde-partial-idea/blob/8bf914141d1e7702024a512f06c1e36aa684bfd9/eclipse-pde-partial-idea/src/main/kotlin/cn/varsa/idea/pde/partial/plugin/config/BundleManagementService.kt#L135-L141
I really wonder why this extension is the only IDEA extension I ever used that has this problem. What is so special or different in it compared to others?
My assumption is that you do something fundamentally wrong in extension design or API usage. Can you not investigate how-tos for extension development or take sneak peeks into other extensions to find out what they do differently?
IDEA just surprised me by offering an update in which this issue is said to be fixed:
First of all, thanks for that. Can you please describe the root cause and how you fixed the problem? Being kind of a regular guest here, having opened several related issues again and again, I am curious.
IDEA just surprised me by offering an update in which this issue is said to be fixed:
First of all, thanks for that. Can you please describe the root cause and how you fixed the problem? Being kind of a regular guest here, having opened several related issues again and again, I am curious.
Em.....Sorry, my mistake I merged the wrong branch into the released version, resulting in an error change record...
The projects in question do not contain the Eclipse PDE Partial facet. That is the whole point of the issue at hand and what surprised me so much in the first place. The projects which trigger the problem may contain various other facets, though, such as AspectJ, Kotlin.
~I cannot remember that any projects without any facets triggered it~ Correction: The very project I mentioned when opening this issue, the Spock Framework, does not contain any facets at all. Therefore, it is not related to whether projects contain any facets or not. It can happen for facet-free projects, but also for projects with various other facets. But they all have in common that there is no PDE Partial facet in either of them.
From beginning to end, I failed to reproduce this problem.
Before reporting the error, there was a code to judge the existence of Facet. It also thought that the PDE Facet existed, which was very strange. I did a lot of manual tests and failed to judge its existence without adding Facet.
This time, I still add the log to the idea.log
and check the Facets of the Module. If there is no PDE Facet but can read it, I can only capture this exception and not deal with it.
I still need to ask you to help me test it this time. eclipse-pde-partial-idea-1.6.4-#108.zip