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

RCPTT tests throws exception, as Display is created before workbench initialisation #478

Open
ngiger opened this issue Oct 3, 2022 · 2 comments

Comments

@ngiger
Copy link
Member

ngiger commented Oct 3, 2022

I am currently sponsoring xored to enable running elexis RCPTT test with eclipse target 2022-06.

In a private E-Mail they wrote me the following

On topic of exception in the log you’ve attached - it seems to be caused my mismatch of  Display object.

The error happens, when Display is created in a background execution thread. Display is bound to the thread it is created in, and is not accessible from other threads. To avoid such errors, make sure that no component attempts to create a Display BEFORE workbench initialisation (or at least outside of main execution thread).

Basically, https://github.com/elexis/elexis-3-core/blob/8b28725dd7b1298b1e17d4805238b1be1871dbbc/bundles/ch.elexis.core.ui/src/ch/elexis/core/ui/UiDesk.java#L123 <https://github.com/elexis/elexis-3-core/blob/8b28725dd7b1298b1e17d4805238b1be1871dbbc/bundles/ch.elexis.core.ui/src/ch/elexis/core/ui/UiDesk.java#L123> is not a legitimate approach, if invoked outside of main application thread.
We often see such errors caused by bundle activators - activators may be invoked from any thread at any time (the order is not defined), but they try (and fail) to access Workbench display anyway, then create their own. The issue is  exacerbated by splash screen and dialogs shown before activation of workbench - sometimes they activate offending bundles.

RCPTT does affect order of bundle activation in AUTs but this not considered to be a bug, as the order is not determined in the first place. Indeed, if you see such problem when using RCPTT, there is a chance it will appear in production at some point.
@col-panic
Copy link
Member

Could you please add the exception you sent as a comment here?

@basilevs
Copy link

This discussion has originated from analysis of a aut-console-0_console.log sent via email.

The particular exception is:

!MESSAGE Application error
!STACK 1
org.eclipse.swt.SWTException: Invalid thread access
	at org.eclipse.swt.SWT.error(SWT.java:4918)
	at org.eclipse.swt.SWT.error(SWT.java:4833)
	at org.eclipse.swt.SWT.error(SWT.java:4804)
	at org.eclipse.swt.widgets.Widget.error(Widget.java:565)
	at org.eclipse.swt.widgets.Shell.<init>(Shell.java:276)
	at org.eclipse.swt.widgets.Shell.<init>(Shell.java:267)
	at org.eclipse.swt.widgets.Shell.<init>(Shell.java:217)
	at ch.elexis.core.application.Desk.start(Desk.java:118)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:402)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1440)
18:56:06.973 [main] ERROR PLATFORM - [org.eclipse.core.runtime] Application error```

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

3 participants