JDK-8058609 : RCP/SWT application exited with an SWTException illegal thread access
  • Type: Bug
  • Component: deploy
  • Sub-Component: webstart
  • Affected Version: 7u67
  • Priority: P4
  • Status: Resolved
  • Resolution: Not an Issue
  • OS: other
  • CPU: x86
  • Submitted: 2014-09-13
  • Updated: 2015-04-21
  • Resolved: 2014-09-25
Related Reports
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :


ADDITIONAL OS VERSION INFORMATION :
Darwin XXXX 13.3.0 Darwin Kernel Version 13.3.0: Tue Jun  3 21:27:35 PDT 2014; root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64

A DESCRIPTION OF THE PROBLEM :
I've installed the latest oracle JRE on my macbook but I can't get our rcp/swt application to start over jnlp.

The app start crashes with
!ENTRY org.eclipse.osgi 4 0 2014-09-13 19:35:07.912
!MESSAGE Application error
!STACK 1
org.eclipse.swt.SWTException: Invalid thread access
        at org.eclipse.swt.SWT.error(SWT.java:4361)
        at org.eclipse.swt.SWT.error(SWT.java:4276)
        at org.eclipse.swt.SWT.error(SWT.java:4247)
        at org.eclipse.swt.widgets.Display.error(Display.java:1070)
        at org.eclipse.swt.widgets.Display.createDisplay(Display.java:827)
        at org.eclipse.swt.widgets.Display.create(Display.java:810)
        at org.eclipse.swt.graphics.Device.<init>(Device.java:130)
        at org.eclipse.swt.widgets.Display.<init>(Display.java:701)
        at org.eclipse.swt.widgets.Display.<init>(Display.java:692)
        at org.eclipse.ui.internal.Workbench.createDisplay(Workbench.java:716)
        at org.eclipse.ui.PlatformUI.createDisplay(PlatformUI.java:161)
        ...

I've found a load of threads with this problem - all with the same solution: add -XstartOnFirstThread to the java-vm-args

According to the jnlp syntax (http://docs.oracle.com/javase/7/docs/technotes/guides/javaws/developersguide/syntax.html) this argument seems to be "insecure" and I think therefore the app crashes because the argument is not passed to the vm.

So I've tried to run the jnlp with latest jre from apple and the app started as expected.
/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Commands/java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

So I think this is a problem of the jre maybe only because -XstartOnFirstThread is not declared as a secure argument.




ADDITIONAL REGRESSION INFORMATION: 
apples jre
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)


ERROR MESSAGES/STACK TRACES THAT OCCUR :
!ENTRY org.eclipse.osgi 4 0 2014-09-13 19:35:07.912
!MESSAGE Application error
!STACK 1
org.eclipse.swt.SWTException: Invalid thread access
        at org.eclipse.swt.SWT.error(SWT.java:4361)
        at org.eclipse.swt.SWT.error(SWT.java:4276)
        at org.eclipse.swt.SWT.error(SWT.java:4247)
        at org.eclipse.swt.widgets.Display.error(Display.java:1070)
        at org.eclipse.swt.widgets.Display.createDisplay(Display.java:827)
        at org.eclipse.swt.widgets.Display.create(Display.java:810)
        at org.eclipse.swt.graphics.Device.<init>(Device.java:130)
        at org.eclipse.swt.widgets.Display.<init>(Display.java:701)
        at org.eclipse.swt.widgets.Display.<init>(Display.java:692)
        at org.eclipse.ui.internal.Workbench.createDisplay(Workbench.java:716)
        at org.eclipse.ui.PlatformUI.createDisplay(PlatformUI.java:161)
        ...

REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
Start with apples jre
/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Commands/javaws


Comments
Adding feedback from the customer about workaround: As suggested that -XstartingOnFirstThread is not allowed due to security restrictions and creating a starter class with System.setProperty() would workaround the issue. However, 1.The vm-argument seems to be required on OSX for SWT-applications - so this property should be a trusted property in jnlp-files. 2. The workaround does not work because - XstartOnFirstThread is a vm-argument and not a system-property.
09-10-2014

This is due to the latest security policies: the set of jvm arguments which could be specified in the JNLP/applet is restricted. Please refer to http://docs.oracle.com/javase/tutorial/deployment/doingMoreWithRIA/settingArgsProperties.html The possible workaround is to create the starter class which sets the needed system properties via System.setProperty() at the very beginning.
25-09-2014

More information from the submitter: The problem occurs only on OSX if an RCP/SWT application is started over webstart. SWT needs the VM-argument -XstartOnFirstThread - this is set in my jnlp. But it seems that the current JRE detects this as insecure argument and removes it from command line. If I use an older jre from apple (1.6) the application starts as expected. With the latest ire from oracle I only get the exception mentioned above.
17-09-2014

Mail sent to submitter requesting more information.
15-09-2014