Community
Participate
Working Groups
i can see multiple of these error messages in our xtend.ide eclipse ui tests with latest target platform !MESSAGE Unhandled event loop exception !STACK 0 org.eclipse.swt.SWTException: Invalid thread access at org.eclipse.swt.SWT.error(SWT.java:4875) at org.eclipse.swt.SWT.error(SWT.java:4790) at org.eclipse.swt.SWT.error(SWT.java:4761) at org.eclipse.swt.widgets.Display.error(Display.java:1103) at org.eclipse.swt.widgets.Display.checkDevice(Display.java:644) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3822) at org.eclipse.ui.internal.dialogs.EventLoopProgressMonitor.runEventLoop(EventLoopProgressMonitor.java:126) at org.eclipse.ui.internal.dialogs.EventLoopProgressMonitor.isCanceled(EventLoopProgressMonitor.java:100) at org.eclipse.core.runtime.SubMonitor$RootInfo.isCanceled(SubMonitor.java:235) at org.eclipse.core.runtime.SubMonitor.isCanceled(SubMonitor.java:581) at org.eclipse.core.runtime.ProgressMonitorWrapper.isCanceled(ProgressMonitorWrapper.java:114) at org.eclipse.core.runtime.ProgressMonitorWrapper.isCanceled(ProgressMonitorWrapper.java:114) at org.eclipse.core.runtime.SubMonitor$RootInfo.isCanceled(SubMonitor.java:235) at org.eclipse.core.runtime.SubMonitor.isCanceled(SubMonitor.java:581) at org.eclipse.core.runtime.ProgressMonitorWrapper.isCanceled(ProgressMonitorWrapper.java:114) at org.eclipse.core.runtime.ProgressMonitorWrapper.isCanceled(ProgressMonitorWrapper.java:114) at org.eclipse.core.runtime.SubMonitor$RootInfo.isCanceled(SubMonitor.java:235) at org.eclipse.core.runtime.SubMonitor.isCanceled(SubMonitor.java:581) at org.eclipse.jdt.internal.core.JavaModelOperation.isCanceled(JavaModelOperation.java:553) at org.eclipse.core.runtime.SubMonitor$RootInfo.isCanceled(SubMonitor.java:235) at org.eclipse.core.runtime.SubMonitor.isCanceled(SubMonitor.java:581) at org.eclipse.jdt.internal.core.search.PatternSearchJob$ParallelSearchMonitor.isCanceled(PatternSearchJob.java:314) at org.eclipse.jdt.core.search.SearchPattern.findIndexMatches(SearchPattern.java:2425) at org.eclipse.jdt.internal.core.search.matching.MatchLocator.findIndexMatches(MatchLocator.java:296) at org.eclipse.jdt.internal.core.search.PatternSearchJob.search(PatternSearchJob.java:214) at org.eclipse.jdt.internal.core.search.SubTypeSearchJob.search(SubTypeSearchJob.java:50) at org.eclipse.jdt.internal.core.search.PatternSearchJob.search(PatternSearchJob.java:194) at org.eclipse.jdt.internal.core.search.PatternSearchJob.lambda$0(PatternSearchJob.java:130) at java.base/java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1448) at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290) at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020) at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656) at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594) at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183) any idea what could cause this. here is the main thread at the same time Object.wait(long) line: not available [native method] ForkJoinTask$AdaptedCallable<T>(ForkJoinTask<V>).externalInterruptibleAwaitDone() line: 356 ForkJoinTask$AdaptedCallable<T>(ForkJoinTask<V>).get() line: 1004 SubTypeSearchJob(PatternSearchJob).performParallelSearch(Index[], SubMonitor) line: 136 SubTypeSearchJob(PatternSearchJob).execute(IProgressMonitor) line: 97 IndexManager(JobManager).performConcurrentJob(IJob, int, IProgressMonitor) line: 265 IndexBasedHierarchyBuilder.legacySearchAllPossibleSubTypes(IType, IJavaSearchScope, Map, IPathRequestor, int, IProgressMonitor) line: 678 IndexBasedHierarchyBuilder.searchAllPossibleSubTypes(IType, IJavaSearchScope, Map, IPathRequestor, int, IProgressMonitor) line: 514 IndexBasedHierarchyBuilder.determinePossibleSubTypes(HashSet, IProgressMonitor) line: 466 IndexBasedHierarchyBuilder.build(boolean) line: 159 TypeHierarchy.compute() line: 323 TypeHierarchy.refresh(IProgressMonitor) line: 1319 CreateTypeHierarchyOperation.executeOperation() line: 94 CreateTypeHierarchyOperation(JavaModelOperation).run(IProgressMonitor) line: 740 CreateTypeHierarchyOperation(JavaModelOperation).runOperation(IProgressMonitor) line: 806 SourceType.newTypeHierarchy(WorkingCopyOwner, IProgressMonitor) line: 950 SourceType.newTypeHierarchy(IProgressMonitor) line: 907 RenameVirtualMethodProcessor.getCachedHierarchy(IType, IProgressMonitor) line: 100 RenameVirtualMethodProcessor.checkInitialConditions(IProgressMonitor) line: 126
This is most likely the regression from bug 567521. I assume if you disable parallel index search, it will work again. From the stack trace looks like the caller passed progress monitor to JDT search that can only be used from UI thread (EventLoopProgressMonitor). If given to parallel instances, the monitor fails to work. Can you please provide simpler steps to reproduce (without xtext)?
Moving to JDT Core as PatternSearchJob is part of JDT Core.
unforunately i have no idea how to strip down this to a simple example
our progress monitor is replace with the eventloop one at org.eclipse.ui.actions.WorkspaceModifyOperation.run(IProgressMonitor)
more main stacktrace: Object.wait(long) line: not available [native method] ForkJoinTask$AdaptedCallable<T>(ForkJoinTask<V>).externalInterruptibleAwaitDone() line: 356 ForkJoinTask$AdaptedCallable<T>(ForkJoinTask<V>).get() line: 1004 SubTypeSearchJob(PatternSearchJob).performParallelSearch(Index[], SubMonitor) line: 136 SubTypeSearchJob(PatternSearchJob).execute(IProgressMonitor) line: 97 IndexManager(JobManager).performConcurrentJob(IJob, int, IProgressMonitor) line: 265 IndexBasedHierarchyBuilder.legacySearchAllPossibleSubTypes(IType, IJavaSearchScope, Map, IPathRequestor, int, IProgressMonitor) line: 678 IndexBasedHierarchyBuilder.searchAllPossibleSubTypes(IType, IJavaSearchScope, Map, IPathRequestor, int, IProgressMonitor) line: 514 IndexBasedHierarchyBuilder.determinePossibleSubTypes(HashSet, IProgressMonitor) line: 466 IndexBasedHierarchyBuilder.build(boolean) line: 159 TypeHierarchy.compute() line: 323 TypeHierarchy.refresh(IProgressMonitor) line: 1319 CreateTypeHierarchyOperation.executeOperation() line: 94 CreateTypeHierarchyOperation(JavaModelOperation).run(IProgressMonitor) line: 740 CreateTypeHierarchyOperation(JavaModelOperation).runOperation(IProgressMonitor) line: 806 SourceType.newTypeHierarchy(WorkingCopyOwner, IProgressMonitor) line: 950 SourceType.newTypeHierarchy(IProgressMonitor) line: 907 RenameVirtualMethodProcessor.getCachedHierarchy(IType, IProgressMonitor) line: 100 RenameVirtualMethodProcessor.checkInitialConditions(IProgressMonitor) line: 126 CombinedJvmJdtRenameProcessor.checkInitialConditions(IProgressMonitor) line: 117 ChangeCombiningRenameRefactoring(ProcessorBasedRefactoring).checkInitialConditions(IProgressMonitor) line: 207 ChangeCombiningRenameRefactoring(Refactoring).checkAllConditions(IProgressMonitor) line: 161 AbstractXtendRenameRefactoringTest$1.execute(IProgressMonitor) line: 158 AbstractXtendRenameRefactoringTest$1(WorkspaceModifyOperation).lambda$0(InvocationTargetException[], IProgressMonitor) line: 110 1901662085.run(IProgressMonitor) line: not available Workspace.run(ICoreRunnable, ISchedulingRule, int, IProgressMonitor) line: 2292 Workspace.run(IWorkspaceRunnable, ISchedulingRule, int, IProgressMonitor) line: 2317 AbstractXtendRenameRefactoringTest$1(WorkspaceModifyOperation).run(IProgressMonitor) line: 131 JavaRefactoringIntegrationTest(AbstractXtendRenameRefactoringTest).renameXtendElement(XtextEditor, int, String, int, IProgressMonitor) line: 163 JavaRefactoringIntegrationTest(AbstractXtendRenameRefactoringTest).renameXtendElement(XtextEditor, int, String, int) line: 147 JavaRefactoringIntegrationTest.testRenameXtendDispatchMethod_1() line: 530 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 62 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43 Method.invoke(Object, Object...) line: 566 FrameworkMethod$1.runReflectiveCall() line: 59 FrameworkMethod$1(ReflectiveCallable).run() line: 12 FrameworkMethod.invokeExplosively(Object, Object...) line: 56 InvokeMethod.evaluate() line: 17 RunBefores.evaluate() line: 26 RunAfters.evaluate() line: 27 ParentRunner$3.evaluate() line: 306 BlockJUnit4ClassRunner$1.evaluate() line: 100
With EventLoopProgressMonitor given to PatternSearchJob we have no chance, we can't use it for single tasks. I will push a patch which I'm not really like, but I don't see a good solution now, especially in jdt core we can't check if we are in UI thread or not because we don't have Display access at all. @Mickael, I believe in the context of the async context assist you had similar issue? Any elegant way to solve it? I will push patch proposal in a second.
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/175402
(In reply to Christian Dietrich from comment #3) > unforunately i have no idea how to strip down this to a simple example Can a *real* user trigger this from UI, or is this "only" a test issue in Xtext, because the tests run in UI thread? Just trying to understand how likely we will see that in real life / if the proposed patch really urgently needed. I see that WorkspaceModifyOperation only supplies EventLoopProgressMonitor if it is running in UI thread, which is probably not a good idea anyway (workspace operations may block), and which is why it is probably not often used this way. One possible workaround for Xtext test (until we will have agreement on right fix) would to either use non UI thread to run or to switch off parallel build.
will check the patch. will also check what happens when you start rename refactoring from eclipse. the main problem is how to get the project into the same state as it is in eclipse.
patch looks good, but i dont get it reproduced with refactoring in ui. i assume this is indeed cause by our test to run a workspacemodifyop from the test code.
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/175403
(In reply to Andrey Loskutov from comment #6) > @Mickael, I believe in the context of the async context assist you had > similar issue? Any elegant way to solve it? For content-assist, we added a flag to the extension point to declare whether extension can run out of UI Thread or not and the consumer of the extension point deals with it accordingly. I don't think it's very elegant; I think bug 548970 is what should in the end lead to something more elegant and more standard.
2nd patch looks good too, from Xtext pov
Gerrit change https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/175403 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=1e70faf6e9d42ea13f06e076a7e7eda11c11be80
(In reply to Christian Dietrich from comment #13) > 2nd patch looks good too, from Xtext pov Patch is merged, please verify after next platform build tomorrow.
looks good. problem is lo longer in our logs