AppContext issues breaks -XstartOnFirstThread for multithreaded programs on both 6_51 and 7_25

Anthony Petrov anthony.petrov at oracle.com
Mon Jul 1 08:16:42 PDT 2013


> In regards to the current mail : it's currently been accepted as bug 9004676

Which is actually 8019496 now. You can watch it on bugs.sun.com (once it 
becomes visible).

The 9* are internal incident numbers, they aren't very useful.

--
best regards,
Anthony

On 07/01/2013 06:48 PM, Erik Vanherck wrote:
> Hi Petr,
>
> Yes I'm aware of that, I'm the original reporter of the SWT_AWT being broken. I try to keep up with the early access builds and have been toying with it already. We still need to back port the SWT changes as we depend on Eclipse 3.7.2 and get our QA to run through it. I definitely appreciate all the hard work you did on that part especially since as a developer I certainly also feel that the whole SWT-AWT bridge thing is just a patch on a workaround on a gaping hole on a bad idea but once those things get out, they start leading their own life :-) Our mac users of that particular application are the very last holdouts on java 1.6 (for us) so would be welcome once we get that out in the field.
>
> In regards to the current mail : it's currently been accepted as bug 9004676
>
> Cheers,
> Erik
>
> On 01 Jul 2013, at 15:09, Petr Pchelko <petr.pchelko at oracle.com> wrote:
>
>> Hello, Erik.
>>
>> About the SWT_AWT bridge: it was broken on the Mac OS X for quite a long time, but the new class was implemented within JDK 7 and 8 to support the bridge. This class would be available with JDK7u40. You could download the early access release here: https://jdk7.java.net/download.html However, the new class is not a drop-in replacement of the Apple's implementation, so some changes were needed in SWT. The latest SWT 4.3 builds support the new implementation.
>>
>> So, JDK7u40 + SWT 4.3 would support the SWT_AWT bridge on the Mac again.
>>
>> Here's the swt issue which covers some details: https://bugs.eclipse.org/bugs/show_bug.cgi?id=374199
>>
>> With best regards. Petr.
>>
>> On Jun 28, 2013, at 7:27 PM, Erik Vanherck wrote:
>>
>>> Nothing really, it was just the simplest test case i came up with. The issue for us is we use swt based apps and even installers all throughout our product suite which do require the parameter and all of them hang at startup. We have one product  which uses the swt_awt bridge as well so we are well aware of the mess there but this is preventing any of the apps to properly work.
>>>
>>> As my test case shows even apps which don't go anywhere near awt (or so they think) will end up with hangs, so it won't be long I guess until some eclipse projects will start bumping into the same issue
>>>
>>> Sent from my iPhone
>>>
>>> On 28 Jun 2013, at 16:52, "Anthony Petrov" <anthony.petrov at oracle.com> wrote:
>>>
>>>> Hi Erik,
>>>>
>>>> While this does look like a bug (please file it at http://bugs.sun.com), I have a question. Since this is not a GUI app, why would you run it with -XstartOnFirstThread ? What exactly are you trying to achieve with this command-line switch?
>>>>
>>>> --
>>>> best regards,
>>>> Anthony
>>>>
>>>> On 06/28/2013 04:57 PM, Erik Vanherck wrote:
>>>>> Hi,
>>>>>
>>>>> I wanted to weigh in a bit since although many people are complaining about the AWT/Swing and webstart issues, it goes much further than that. The AppContext can trigger AWT loading from many locations even as simple as java.util.logging or jmx. In my mind I find it extremely suspicious that these low level utility classes should try to do anything with AWT, especially considering server apps.
>>>>>
>>>>> This test program results in a hang in the spawned thread trying to load in one of the 3 places both on Apple java 1.6.0_51 (with and without the Apple 09 hotfix) and Java 1.7.0_25. It runs as normal java applications, no applet or webstart required, no security manager set, Just add -XstartOnFirstThread to the commandline.
>>>>>
>>>>> import java.lang.management.ManagementFactory;
>>>>> import java.util.logging.Logger;
>>>>>
>>>>> import javax.imageio.spi.IIORegistry;
>>>>> import javax.management.MBeanServer;
>>>>>
>>>>> /**
>>>>> * @author evanherc
>>>>> */
>>>>> public class AppContextJVMBug {
>>>>>
>>>>> public static void main(String[] args) {
>>>>> try {
>>>>> System.out.println("Launching");
>>>>>
>>>>> final Thread t = new Thread(new Runnable() {
>>>>> public void run() {
>>>>> try {
>>>>> utilLoggingHang();
>>>>> jmxHang();
>>>>> imageioHang();
>>>>> } catch (Throwable t) {
>>>>> t.printStackTrace();
>>>>> }
>>>>> }
>>>>> });
>>>>>
>>>>> t.start();
>>>>> t.join();
>>>>> System.out.println("Finished");
>>>>> } catch (Throwable t) {
>>>>> t.printStackTrace();
>>>>> }
>>>>> }
>>>>>
>>>>> private static void utilLoggingHang() {
>>>>> final Logger l = Logger.getLogger("MyApp");
>>>>> System.out.println("Done obtaining a logger " + l);
>>>>> }
>>>>>
>>>>> private static void jmxHang() {
>>>>> final MBeanServer mb = ManagementFactory.getPlatformMBeanServer();
>>>>> System.out.println("Done getting the platform mbean server " + mb);
>>>>> }
>>>>>
>>>>> private static void imageioHang() {
>>>>> final IIORegistry registry = IIORegistry.getDefaultInstance();
>>>>> System.out.println("Done retrieving image registry " + registry);
>>>>> }
>>>>> }
>>>>>
>>>>>
>>>>>
>>>>> Tested on several Apple Mac OS X 10.8.4 machines.
>>>>> Without JVM arguments : runs fine
>>>>> With -XstartOnFirstThread : hangs
>>>>> With -XstartOnFirstThread and -Djava.awt.headless=true : runs fine
>>>>>
>>>>> Here's actual stack traces from our large product suites. They break for everyone as we run inside Eclipse and as such have to specify -XstartOnFirstThread.
>>>>> I've seen a dozen variants now (there is other classes triggering AppContext as well).
>>>>>
>>>>> "Thread-4" daemon prio=5 tid=7febb49ae800 nid=0x10f2fb000 runnable [10f2f6000]
>>>>>   java.lang.Thread.State: RUNNABLE
>>>>> at java.lang.ClassLoader$NativeLibrary.load(Native Method)
>>>>> at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1827)
>>>>> - locked <7dc02aec0> (a java.util.Vector)
>>>>> - locked <7dc02aee0> (a java.util.Vector)
>>>>> at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1724)
>>>>> at java.lang.Runtime.loadLibrary0(Runtime.java:823)
>>>>> - locked <7dc02cb28> (a java.lang.Runtime)
>>>>> at java.lang.System.loadLibrary(System.java:1045)
>>>>> at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:50)
>>>>> at java.security.AccessController.doPrivileged(Native Method)
>>>>> at java.awt.Toolkit.loadLibraries(Toolkit.java:1605)
>>>>> at java.awt.Toolkit.<clinit>(Toolkit.java:1627)
>>>>> at sun.awt.AppContext$2.run(AppContext.java:240)
>>>>> at sun.awt.AppContext$2.run(AppContext.java:226)
>>>>> at java.security.AccessController.doPrivileged(Native Method)
>>>>> at sun.awt.AppContext.initMainAppContext(AppContext.java:226)
>>>>> at sun.awt.AppContext.access$200(AppContext.java:112)
>>>>> at sun.awt.AppContext$3.run(AppContext.java:306)
>>>>> at java.security.AccessController.doPrivileged(Native Method)
>>>>> at sun.awt.AppContext.getAppContext(AppContext.java:287)
>>>>> at com.sun.jmx.trace.Trace.out(Trace.java:180)
>>>>> - locked <7f8eea490> (a java.lang.Class for com.sun.jmx.trace.Trace)
>>>>> at com.sun.jmx.trace.Trace.isSelected(Trace.java:88)
>>>>> at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.isTraceOn(DefaultMBeanServerInterceptor.java:1830)
>>>>> at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:929)
>>>>> at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:916)
>>>>> at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:312)
>>>>> at com.sun.jmx.mbeanserver.JmxMBeanServer$2.run(JmxMBeanServer.java:1195)
>>>>> at java.security.AccessController.doPrivileged(Native Method)
>>>>> at com.sun.jmx.mbeanserver.JmxMBeanServer.initialize(JmxMBeanServer.java:1193)
>>>>> at com.sun.jmx.mbeanserver.JmxMBeanServer.<init>(JmxMBeanServer.java:225)
>>>>> at com.sun.jmx.mbeanserver.JmxMBeanServer.<init>(JmxMBeanServer.java:170)
>>>>> at com.sun.jmx.mbeanserver.JmxMBeanServer.newMBeanServer(JmxMBeanServer.java:1401)
>>>>> at javax.management.MBeanServerBuilder.newMBeanServer(MBeanServerBuilder.java:93)
>>>>> at javax.management.MBeanServerFactory.newMBeanServer(MBeanServerFactory.java:311)
>>>>> - locked <7d824f618> (a javax.management.MBeanServerBuilder)
>>>>> at javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:214)
>>>>> at javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:175)
>>>>> at sun.management.ManagementFactory.createPlatformMBeanServer(ManagementFactory.java:302)
>>>>> at java.lang.management.ManagementFactory.getPlatformMBeanServer(ManagementFactory.java:504)
>>>>> - locked <7f8e00140> (a java.lang.Class for java.lang.management.ManagementFactory)
>>>>> at id.core.version.provider.ProductVersionProvider.<init>(ProductVersionProvider.java:68)
>>>>> at id.core.version.provider.ProductVersionProvider.getInstance(ProductVersionProvider.java:37)
>>>>> - locked <7f8dd00a8> (a java.lang.Class for id.core.version.provider.ProductVersionProvider)
>>>>> at id.core.version.VersionInfo.getProductID(VersionInfo.java:98)
>>>>> at com.id.core.platform.util.application.ProductDirectories.calculateCurrentUserProgramDir(ProductDirectories.java:31)
>>>>> at com.id.core.platform.util.application.ProductDirectories.<clinit>(ProductDirectories.java:22)
>>>>> at com.id.core.platform.repository.BundleRepository.parsePluginFile(BundleRepository.java:235)
>>>>> at com.id.core.platform.repository.BundleRepository.<init>(BundleRepository.java:101)
>>>>> at com.id.core.platform.Platform.bootstrap(Platform.java:178)
>>>>> - locked <7d81cb4c8> (a java.lang.Object)
>>>>> - locked <7d81cb4a8> (a com.id.core.platform.Platform)
>>>>> at com.id.core.platform.activator.Activator$1.run(Activator.java:77)
>>>>> - locked <7d81aca68> (a java.lang.Object)
>>>>>
>>>>> "Thread-2" prio=5 tid=0x00007f9973093800 nid=0x7e03 runnable [0x0000000137b2f000]
>>>>>   java.lang.Thread.State: RUNNABLE
>>>>> at java.lang.ClassLoader$NativeLibrary.load(Native Method)
>>>>> at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1957)
>>>>> - locked <0x0000000128bc39a8> (a java.util.Vector)
>>>>> - locked <0x0000000128bc3610> (a java.util.Vector)
>>>>> at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1882)
>>>>> at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1843)
>>>>> at java.lang.Runtime.load0(Runtime.java:795)
>>>>> - locked <0x0000000110a457a8> (a java.lang.Runtime)
>>>>> at java.lang.System.load(System.java:1061)
>>>>> at java.lang.ClassLoader$NativeLibrary.load(Native Method)
>>>>> at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1957)
>>>>> - locked <0x0000000128bc39a8> (a java.util.Vector)
>>>>> - locked <0x0000000128bc3610> (a java.util.Vector)
>>>>> at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1882)
>>>>> at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1864)
>>>>> at java.lang.Runtime.loadLibrary0(Runtime.java:849)
>>>>> - locked <0x0000000110a457a8> (a java.lang.Runtime)
>>>>> at java.lang.System.loadLibrary(System.java:1087)
>>>>> at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:67)
>>>>> at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:47)
>>>>> at java.security.AccessController.doPrivileged(Native Method)
>>>>> at java.awt.Toolkit.loadLibraries(Toolkit.java:1646)
>>>>> at java.awt.Toolkit.<clinit>(Toolkit.java:1668)
>>>>> at sun.awt.AppContext$2.run(AppContext.java:271)
>>>>> at sun.awt.AppContext$2.run(AppContext.java:260)
>>>>> at java.security.AccessController.doPrivileged(Native Method)
>>>>> at sun.awt.AppContext.initMainAppContext(AppContext.java:260)
>>>>> at sun.awt.AppContext.access$200(AppContext.java:133)
>>>>> at sun.awt.AppContext$3.run(AppContext.java:316)
>>>>> at sun.awt.AppContext$3.run(AppContext.java:298)
>>>>> at java.security.AccessController.doPrivileged(Native Method)
>>>>> at sun.awt.AppContext.getAppContext(AppContext.java:297)
>>>>> at javax.imageio.spi.IIORegistry.getDefaultInstance(IIORegistry.java:154)
>>>>> at com.id.external.javax.media.jai.Services.register(Services.java:20)
>>>>> at com.id.external.javax.media.jai.activator.Activator.start(Activator.java:26)
>>>>> at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)
>>>>> at java.security.AccessController.doPrivileged(Native Method)
>>>>> at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702)
>>>>> at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683)
>>>>> at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381)
>>>>> at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:299)
>>>>> at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:291)
>>>>> at com.id.core.platform.repository.BundleRepository.startBundle(BundleRepository.java:486)
>>>>> at com.id.core.platform.repository.BundleRepository.handleResolvedBundle(BundleRepository.java:389)
>>>>> at com.id.core.platform.repository.BundleRepository.scanBundles(BundleRepository.java:269)
>>>>> at com.id.core.platform.repository.BundleRepository.start(BundleRepository.java:118)
>>>>> - locked <0x00000001259d7d20> (a java.lang.Object)
>>>>> at com.id.core.platform.Platform.bootstrap(Platform.java:184)
>>>>> - locked <0x00000001259d4000> (a java.lang.Object)
>>>>> - locked <0x00000001259d3fe0> (a com.id.core.platform.Platform)
>>>>> at com.id.core.platform.activator.Activator$1.run(Activator.java:77)
>>>>> - locked <0x00000001259ce758> (a java.lang.Object)
>>>>>
>>>>> I've been looking in the source but not sure if those fixes are already in the jdk 1.7u forest.
>>>>>
>>>>> Erik Vanherck
>>>>>
>>>>> ________________________________
>>>>>
>>>>> Inventive Designers' Email Disclaimer:
>>>>> http://www.inventivedesigners.com/email-disclaimer
>>>>
>>>>
>>>
>>> ________________________________
>>>
>>> Inventive Designers' Email Disclaimer:
>>> http://www.inventivedesigners.com/email-disclaimer
>>
>>
>>
>
>
> ________________________________
>
> Inventive Designers' Email Disclaimer:
> http://www.inventivedesigners.com/email-disclaimer
>


More information about the macosx-port-dev mailing list