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

PlainJarExportTests test fails due the monitor use in wrong thread #3718

Closed
iloveeclipse opened this issue Feb 11, 2025 · 12 comments · May be fixed by eclipse-platform/eclipse.platform.ui#2792
Assignees
Labels
bug Something isn't working regression Something was broken by a previous change
Milestone

Comments

@iloveeclipse
Copy link
Member

Regression from #3711

3 tests fail now on all platforms, see for exampe https://download.eclipse.org/eclipse/downloads/drops4/I20250210-1800/testresults/html/org.eclipse.jdt.ui.tests_ep435I-unit-linux-x86_64-java21_linux.gtk.x86_64_21.html

Most relevant stack:

Contains: Errors running builder 'Java Builder' on project 'TestSetupProject'.
org.eclipse.swt.SWTException: Invalid thread access
at org.eclipse.swt.SWT.error(SWT.java:4932)
at org.eclipse.swt.SWT.error(SWT.java:4847)
at org.eclipse.swt.SWT.error(SWT.java:4818)
at org.eclipse.swt.widgets.Widget.error(Widget.java:598)
at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:514)
at org.eclipse.swt.widgets.Control.getForeground(Control.java:3149)
at org.eclipse.jface.action.StatusLine.updateMessageLabel(StatusLine.java:702)
at org.eclipse.jface.action.StatusLine.subTask(StatusLine.java:662)
at org.eclipse.jface.action.StatusLineManager$1.subTask(StatusLineManager.java:214)
at org.eclipse.core.runtime.ProgressMonitorWrapper.subTask(ProgressMonitorWrapper.java:160)
at org.eclipse.ui.internal.dialogs.EventLoopProgressMonitor.subTask(EventLoopProgressMonitor.java:175)
at org.eclipse.core.runtime.SubMonitor$RootInfo.subTask(SubMonitor.java:299)
at org.eclipse.core.runtime.SubMonitor.subTask(SubMonitor.java:750)
at org.eclipse.core.runtime.ProgressMonitorWrapper.subTask(ProgressMonitorWrapper.java:160)
at org.eclipse.core.runtime.SubProgressMonitor.subTask(SubProgressMonitor.java:200)
at org.eclipse.core.runtime.ProgressMonitorWrapper.subTask(ProgressMonitorWrapper.java:160)
at org.eclipse.core.runtime.SubProgressMonitor.subTask(SubProgressMonitor.java:200)
at org.eclipse.core.runtime.SubMonitor$RootInfo.subTask(SubMonitor.java:299)
at org.eclipse.core.runtime.SubMonitor.subTask(SubMonitor.java:750)
at org.eclipse.core.runtime.ProgressMonitorWrapper.subTask(ProgressMonitorWrapper.java:160)
at org.eclipse.core.runtime.SubProgressMonitor.subTask(SubProgressMonitor.java:200)
at org.eclipse.jdt.internal.core.builder.BuildNotifier.subTask(BuildNotifier.java:250)
at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder$2.setTaskName(AbstractImageBuilder.java:644)
at org.eclipse.jdt.internal.compiler.Compiler.reportProgress(Compiler.java:290)
at org.eclipse.jdt.internal.compiler.ProcessTaskManager.processing(ProcessTaskManager.java:128)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)

Full fail:

JAR creation failed. See details for additional information.

org.eclipse.core.runtime.CoreException: JAR creation failed. See details for additional information.
at org.eclipse.jdt.ui.tests.jarexport.PlainJarExportTests.createArchive(PlainJarExportTests.java:173)
at org.eclipse.jdt.ui.tests.jarexport.PlainJarExportTests.exportCu(PlainJarExportTests.java:108)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
Contains: Build failed for project: TestSetupProject
org.eclipse.core.internal.resources.ResourceException: Errors occurred during the build.
at org.eclipse.core.internal.resources.Project$1.run(Project.java:607)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2457)
at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:642)
at org.eclipse.core.internal.resources.Project.build(Project.java:154)
at org.eclipse.jdt.internal.ui.jarpackager.JarFileExportOperation.buildProjects(JarFileExportOperation.java:1142)
at org.eclipse.jdt.internal.ui.jarpackager.JarFileExportOperation.singleRun(JarFileExportOperation.java:996)
at org.eclipse.jdt.internal.ui.jarpackager.JarFileExportOperation.execute(JarFileExportOperation.java:977)
at org.eclipse.ui.actions.WorkspaceModifyOperation.lambda$0(WorkspaceModifyOperation.java:112)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2457)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2482)
at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:131)
at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:434)
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:354)
at org.eclipse.ui.internal.WorkbenchWindow.lambda$7(WorkbenchWindow.java:2335)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:2332)
at org.eclipse.jdt.ui.tests.jarexport.PlainJarExportTests.createArchive(PlainJarExportTests.java:169)
at org.eclipse.jdt.ui.tests.jarexport.PlainJarExportTests.exportCu(PlainJarExportTests.java:108)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:54)
at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:61)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
at org.junit.vintage.engine.execution.RunnerExecutor.execute(RunnerExecutor.java:42)
at org.junit.vintage.engine.VintageTestEngine.executeAllChildren(VintageTestEngine.java:80)
at org.junit.vintage.engine.VintageTestEngine.execute(VintageTestEngine.java:72)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:198)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:169)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:93)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:76)
at org.junit.platform.suite.engine.SuiteLauncher.execute(SuiteLauncher.java:63)
at org.junit.platform.suite.engine.SuiteTestDescriptor.executeTests(SuiteTestDescriptor.java:168)
at org.junit.platform.suite.engine.SuiteTestDescriptor.execute(SuiteTestDescriptor.java:137)
at org.junit.platform.suite.engine.SuiteTestEngine.lambda$execute$0(SuiteTestEngine.java:73)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1939)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
at org.junit.platform.suite.engine.SuiteTestEngine.execute(SuiteTestEngine.java:73)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:198)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:169)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:93)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:76)
at org.junit.platform.suite.engine.SuiteLauncher.execute(SuiteLauncher.java:63)
at org.junit.platform.suite.engine.SuiteTestDescriptor.executeTests(SuiteTestDescriptor.java:168)
at org.junit.platform.suite.engine.SuiteTestDescriptor.execute(SuiteTestDescriptor.java:137)
at org.junit.platform.suite.engine.SuiteTestEngine.lambda$execute$0(SuiteTestEngine.java:73)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1939)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
at org.junit.platform.suite.engine.SuiteTestEngine.execute(SuiteTestEngine.java:73)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:198)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:169)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:93)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:58)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:141)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:57)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:103)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:85)
at org.junit.platform.launcher.core.DelegatingLauncher.execute(DelegatingLauncher.java:47)
at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:63)
at org.eclipse.test.EclipseTestRunner.runTests(EclipseTestRunner.java:212)
at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.java:187)
at org.eclipse.test.UITestApplication.lambda$0(UITestApplication.java:101)
at org.eclipse.e4.ui.internal.workbench.swt.E4Testable.lambda$1(E4Testable.java:127)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:132)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:5044)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4524)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1151)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1042)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:668)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:576)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:173)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:178)
at org.eclipse.test.UITestApplication.run(UITestApplication.java:48)
at org.eclipse.test.UITestApplication.start(UITestApplication.java:116)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:208)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:149)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:115)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:467)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:298)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:668)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:605)
at org.eclipse.equinox.launcher.Main.run(Main.java:1481)
at org.eclipse.equinox.launcher.Main.main(Main.java:1454)
Contains: Errors running builder 'Java Builder' on project 'TestSetupProject'.
org.eclipse.swt.SWTException: Invalid thread access
at org.eclipse.swt.SWT.error(SWT.java:4932)
at org.eclipse.swt.SWT.error(SWT.java:4847)
at org.eclipse.swt.SWT.error(SWT.java:4818)
at org.eclipse.swt.widgets.Widget.error(Widget.java:598)
at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:514)
at org.eclipse.swt.widgets.Control.getForeground(Control.java:3149)
at org.eclipse.jface.action.StatusLine.updateMessageLabel(StatusLine.java:702)
at org.eclipse.jface.action.StatusLine.subTask(StatusLine.java:662)
at org.eclipse.jface.action.StatusLineManager$1.subTask(StatusLineManager.java:214)
at org.eclipse.core.runtime.ProgressMonitorWrapper.subTask(ProgressMonitorWrapper.java:160)
at org.eclipse.ui.internal.dialogs.EventLoopProgressMonitor.subTask(EventLoopProgressMonitor.java:175)
at org.eclipse.core.runtime.SubMonitor$RootInfo.subTask(SubMonitor.java:299)
at org.eclipse.core.runtime.SubMonitor.subTask(SubMonitor.java:750)
at org.eclipse.core.runtime.ProgressMonitorWrapper.subTask(ProgressMonitorWrapper.java:160)
at org.eclipse.core.runtime.SubProgressMonitor.subTask(SubProgressMonitor.java:200)
at org.eclipse.core.runtime.ProgressMonitorWrapper.subTask(ProgressMonitorWrapper.java:160)
at org.eclipse.core.runtime.SubProgressMonitor.subTask(SubProgressMonitor.java:200)
at org.eclipse.core.runtime.SubMonitor$RootInfo.subTask(SubMonitor.java:299)
at org.eclipse.core.runtime.SubMonitor.subTask(SubMonitor.java:750)
at org.eclipse.core.runtime.ProgressMonitorWrapper.subTask(ProgressMonitorWrapper.java:160)
at org.eclipse.core.runtime.SubProgressMonitor.subTask(SubProgressMonitor.java:200)
at org.eclipse.jdt.internal.core.builder.BuildNotifier.subTask(BuildNotifier.java:250)
at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder$2.setTaskName(AbstractImageBuilder.java:644)
at org.eclipse.jdt.internal.compiler.Compiler.reportProgress(Compiler.java:290)
at org.eclipse.jdt.internal.compiler.ProcessTaskManager.processing(ProcessTaskManager.java:128)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)
Contains: Exported with compile errors: TestSetupProject/src/org/eclipse/jdt/ui/test/Main.java
Contains: Class files on classpath not found or not accessible for: 'TestSetupProject/src/org/eclipse/jdt/ui/test/Main.java'
@iloveeclipse iloveeclipse added bug Something isn't working regression Something was broken by a previous change labels Feb 11, 2025
@iloveeclipse iloveeclipse added this to the 4.35 M3 milestone Feb 11, 2025
@jukzi
Copy link
Contributor

jukzi commented Feb 11, 2025

At the first glance I have no idea how jdt.core could use ui tools like Display.asyncExec to delegate to ui thread. Anyone? @mickaelistria? At worst we would have to revert until solution found.

@mickaelistria
Copy link
Contributor

mickaelistria commented Feb 11, 2025

I don't think it's a matter of UI vs non-UI here. It's possible that the change adding the reporter now makes that an error that used to be invisible now becomes more visible. I'll try to reproduce and investigate it.

jukzi pushed a commit to jukzi/eclipse.jdt.core that referenced this issue Feb 11, 2025
ProgressMonitor can only be called in SWT Thread.

partial revert of 20b7abd
Keeping the CompilationProgress.isCanceled()

eclipse-jdt#3718
@iloveeclipse
Copy link
Member Author

At the first glance I have no idea how jdt.core could use ui tools like Display.asyncExec to delegate to ui thread. Anyone? @mickaelistria? At worst we would have to revert until solution found.

The monitor passed to org.eclipse.core.internal.events.BuildManager.getSafeRunnable(...).new ISafeRunnable() {...}.run() is the problem.

@iloveeclipse
Copy link
Member Author

The change in compiler that reports to this "wrong" UI monitor now "uncovered" that problem of the wrong monitor being used in the build context.

I believe reverting original change would be safest for M3, because monitor issues are known to popping up at most unexpected places...

@mickaelistria
Copy link
Contributor

the monitor passed to org.eclipse.core.internal.events.BuildManager.getSafeRunnable(...).new ISafeRunnable() {...}.run() is the problem.

Ok, thanks. Did you manage to get a hint of where is this monitor created? I think it's a safe solution to wrap the updates to the monitor in some asyncExec when not in the UI thread.

@jukzi
Copy link
Contributor

jukzi commented Feb 11, 2025

That ProgressMonitor is coming from way up in platform Buildmanager

@iloveeclipse
Copy link
Member Author

the monitor passed to org.eclipse.core.internal.events.BuildManager.getSafeRunnable(...).new ISafeRunnable() {...}.run() is the problem.

Ok, thanks. Did you manage to get a hint of where is this monitor created? I think it's a safe solution to wrap the updates to the monitor in some asyncExec when not in the UI thread.

The monitor is from UI ModalContext, see stack:

Thread [main] (Suspended (breakpoint at line 1045 in BuildManager))	


	at org.eclipse.core.internal.events.BuildManager.getSafeRunnable(BuildManager.java:1045)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:296)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:352)
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:441)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:444)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:403)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:668)
	at org.eclipse.core.internal.resources.Project$1.run(Project.java:604)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2457)
	at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:642)
	at org.eclipse.core.internal.resources.Project.build(Project.java:154)
	at org.eclipse.jdt.internal.ui.jarpackager.JarFileExportOperation.buildProjects(JarFileExportOperation.java:1142)
	at org.eclipse.jdt.internal.ui.jarpackager.JarFileExportOperation.singleRun(JarFileExportOperation.java:996)
	at org.eclipse.jdt.internal.ui.jarpackager.JarFileExportOperation.execute(JarFileExportOperation.java:977)
	at org.eclipse.ui.actions.WorkspaceModifyOperation.lambda$0(WorkspaceModifyOperation.java:112)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2457)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2482)
	at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:131)
	at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:434)
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:354)
	at org.eclipse.ui.internal.WorkbenchWindow.lambda$7(WorkbenchWindow.java:2335)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
	at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:2332)
	at org.eclipse.jdt.ui.tests.jarexport.PlainJarExportTests.createArchive(PlainJarExportTests.java:169)
	at org.eclipse.jdt.ui.tests.jarexport.PlainJarExportTests.exportCu(PlainJarExportTests.java:108)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:54)
	at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:61)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:93)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:40)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:520)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:748)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:443)
	at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:83)
	at org.eclipse.pde.internal.junit.runtime.PlatformUITestHarness.lambda$0(PlatformUITestHarness.java:45)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Testable.lambda$1(E4Testable.java:127)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:132)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:5044)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4524)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1151)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1042)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:668)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:576)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:173)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:178)
	at org.eclipse.pde.internal.junit.runtime.NonUIThreadTestApplication.start(NonUIThreadTestApplication.java:58)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:208)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:149)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:115)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:467)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:298)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:668)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:605)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1481)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1454)

@mickaelistria
Copy link
Contributor

Unfortunately, this change is breaking proper reporting when using a 3rd party compiler, so we have to re-add a workaround for it in the javac integration code.
Some other methods in JFace's StatusLine already wrap invocation of updateMessageLabel in inUIThread. I'm going to propagate this to other cases coming from IProgressManager and then we'll be able to revert the reverted bits.

mickaelistria added a commit to mickaelistria/eclipse.platform.ui that referenced this issue Feb 12, 2025
Since monitor methods may be invoked from any thread, make sure we wrap
all SWT operations in UI Thread.

Fixes eclipse-jdt/eclipse.jdt.core#3718
@mickaelistria
Copy link
Contributor

This should be a better fix: eclipse-platform/eclipse.platform.ui#2792

@iloveeclipse
Copy link
Member Author

I'm going to propagate this to other cases coming from IProgressManager and then we'll be able to revert the reverted bits.

The question for me is if that would break on another use case (not covered by automated tests) where monitor is passed from UI to compiler => this would be too risky for M3 IMO.

@mickaelistria
Copy link
Contributor

If only StatusLine has been correct a day before, this patch wouldn't have brought any concern although it would have been equally risky...

@iloveeclipse
Copy link
Member Author

If only StatusLine has been correct a day before, this patch wouldn't have brought any concern although it would have been equally risky...

That's life. Now we know that it is risky.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working regression Something was broken by a previous change
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants