AppContext issue in Apple Java 6 -- same issue in Oracle Java 7?
Doug.Zwick at blackboard.com
Wed Jun 26 15:46:39 PDT 2013
James Tomson wrote:
> We've been experiencing lockup issues with our Java Web Start application
> on MacOSX since the introduction of 7u25. Running with 7u25, our
> application is now invoking swing methods on both the AWT-EventQueue owned
> by our 'main' thread group, as well as a queue instance owned by a
> "javawsApplicationThreadGroup" group.
> Now in this situation of dispatching events multiple AWT-EventQueues there
> is a risk of deadlock, and in our case we've seen these fairly frequently
> with 7u25, which renders our app unresponsive and must be forced quit.
I have dug deeper into this, and we are somehow getting our code running on AWT-EventQueue-0 in the "main" ThreadGroup, and not on AWT-EventQueue-2 in the "javawsApplicationThreadGroup" group. One way this will happen is callbacks on the AppKit thread, as we can see in the thread dumps that AWT-AppKit is in the "main" group. However, it is not just our JNI code that can cause this, it looks like the EAWT API for wiring up the About, Preferences and Quit menu items in the application menu will queue their callbacks up on AWT-EventQueue-0 as well, as per this stack trace I generated by instrumenting requests to our Swing invokeLater bottleneck routine:
@ java.security.AccessController.doPrivileged(Native Method)
This call was made on AWT-EventQueue-0, in the "main" ThreadGroup. It looks like the EAWT code needs to be updated to shift into the proper thread group before trying to queue its "_AppEventDispatcher$1" anonymous Runnable on the EDT.
The "Legacy" in "AppEventLegacyHandler" is interesting. I'll have to dig deeper, and verify that we are using the current API for registering the About/Preferences/Quit handlers.
This email and any attachments may contain confidential and proprietary information of Blackboard that is for the sole use of the intended recipient. If you are not the intended recipient, disclosure, copying, re-distribution or other use of any of this information is strictly prohibited. Please immediately notify the sender and delete this transmission if you received this email in error.
More information about the macosx-port-dev