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

actionsfilter.runtime causes assertion "!app.isDispatchThread()" #2340

Open
svott7 opened this issue Dec 12, 2023 · 1 comment
Open

actionsfilter.runtime causes assertion "!app.isDispatchThread()" #2340

svott7 opened this issue Dec 12, 2023 · 1 comment

Comments

@svott7
Copy link

svott7 commented Dec 12, 2023

The action filter causes assertion:

Exception java.lang.Throwable: Assertion failed: assert !app.isDispatchThread()
at com.intellij.openapi.diagnostic.Logger.assertTrue(Logger.java:220)

at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.<init>(ActionManagerImpl.java:135)

at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)

at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)

at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)

at com.intellij.serviceContainer.ConstructorInjectionKt.instantiateUsingPicoContainer(constructorInjection.kt:47)

at com.intellij.serviceContainer.ComponentManagerImpl.instantiateClassWithConstructorInjection(ComponentManagerImpl.kt:890)

at com.intellij.serviceContainer.ServiceComponentAdapter.createAndInitialize(ServiceComponentAdapter.kt:51)

at com.intellij.serviceContainer.ServiceComponentAdapter.doCreateInstance(ServiceComponentAdapter.kt:41)

at com.intellij.serviceContainer.BaseComponentAdapter.getInstanceUncached(BaseComponentAdapter.kt:119)

at com.intellij.serviceContainer.BaseComponentAdapter.getInstance(BaseComponentAdapter.kt:73)

at com.intellij.serviceContainer.BaseComponentAdapter.getInstance$default(BaseComponentAdapter.kt:66)

at com.intellij.serviceContainer.ComponentManagerImpl.doGetService(ComponentManagerImpl.kt:609)

at com.intellij.serviceContainer.ComponentManagerImpl.getService(ComponentManagerImpl.kt:583)

at com.intellij.openapi.client.ClientAwareComponentManager.getFromSelfOrCurrentSession(ClientAwareComponentManager.kt:37)

at com.intellij.openapi.client.ClientAwareComponentManager.getService(ClientAwareComponentManager.kt:22)

at com.intellij.openapi.actionSystem.ActionManager.getInstance(ActionManager.java:29)

at com.mbeddr.mpsutil.actionsfilter.runtime.ActionFilter$12.select(ActionFilter.java:155)

at com.mbeddr.mpsutil.actionsfilter.runtime.ActionFilter$12.select(ActionFilter.java:153)

at jetbrains.mps.internal.collections.runtime.ISelector.invoke(ISelector.java:12)

at jetbrains.mps.internal.collections.runtime.impl.SelectingSequence$SelectingIterator.moveToNext(SelectingSequence.java:60)

at jetbrains.mps.internal.collections.runtime.impl.SelectingSequence$SelectingIterator.hasNext(SelectingSequence.java:32)

at jetbrains.mps.internal.collections.runtime.impl.FilteringSequence$FilteringIterator.moveToNext(FilteringSequence.java:61)

at jetbrains.mps.internal.collections.runtime.impl.FilteringSequence$FilteringIterator.hasNext(FilteringSequence.java:34)

at jetbrains.mps.internal.collections.runtime.ListSequence.fromIterable(ListSequence.java:122)

at jetbrains.mps.internal.collections.runtime.AbstractSequence.toListSequence(AbstractSequence.java:215)

at com.mbeddr.mpsutil.actionsfilter.runtime.ActionFilter.getActions(ActionFilter.java:161)

at com.mbeddr.mpsutil.actionsfilter.runtime.ActionFilter.applyFilters(ActionFilter.java:132)

at com.mbeddr.mpsutil.actionsfilter.runtime.ActionFilter.addFilters(ActionFilter.java:92)

at com.mbeddr.mpsutil.actionsfilter.runtime.ActionFilter.setFilters(ActionFilter.java:123)

at com.mbeddr.mpsutil.actionsfilter.runtime.ActionFilter.setFilters(ActionFilter.java:127)

at com.mbeddr.mpsutil.actionsfilter.runtime.ActionsApplicationComponent.applyFilter(ActionsApplicationComponent.java:64)

at com.mbeddr.mpsutil.actionsfilter.runtime.ActionsApplicationComponent.lambda$loadState$0(ActionsApplicationComponent.java:46)

at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)

at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:789)

at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:740)

at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:734)

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:759)

at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:918)

at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:766)

at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:450)

at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:791)

at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:449)

at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:105)

at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:624)

at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:447)

at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:881)

at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:493)

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)

MPS: 2022.2.1
Mbeddr: 2022.2.23923.7909945

Our customer said that ther exception appeared spontanously multiple times. Is there anything we can do to prevent the problem?

@alexanderpann
Copy link
Member

alexanderpann commented Dec 15, 2023

The problem is probably that in ActionFilter#getActions the class ActionManager gets initialized when this class is the first one that calls ActionManager.getInstance. The initialization is not allowed on the EDT/UI thread but the code is executed here on the EDT thread. We would probably need to move the SwingUtilities#invokeLater call to the actual location where we need to update the UI, so that the initialization happens on the right thread or we quickly move to another thread for this single line of code.

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

2 participants