JDK-8132382 : [macosx] Crash during JMC or JavaFX execution when NSApplication is controlled by SWT or JavaFX libraries
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: emb-8u60,8u60,9
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • Submitted: 2015-07-27
  • Updated: 2016-01-14
  • Resolved: 2015-07-30
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
8u60Fixed 9 b78Fixed
Related Reports
Duplicate :  
Relates :  
When running JMC 6.0 with the JConsole plug-in on JDK 9 we experience crashes with something like this output:

     [java] 2015-07-27 11:08:27.946 java[93835:4650052] -[SWTApplication postRunnableEvent:]: unrecognized selector sent to instance 0x7fc322e1bf20
     [java] 2015-07-27 11:08:27.947 java[93835:4650052] Apple AWT Internal Exception: -[SWTApplication postRunnableEvent:]: unrecognized selector sent to instance 0x7fc322e1bf20
     [java] 2015-07-27 11:08:27.947 java[93835:4650052] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SWTApplication postRunnableEvent:]: unrecognized selector sent to instance 0x7fc322e1bf20'
     [java] *** First throw call stack:
     [java] (
     [java] 	0   CoreFoundation                      0x00007fff9146d03c __exceptionPreprocess + 172
     [java] 	1   libobjc.A.dylib                     0x00007fff8e8d776e objc_exception_throw + 43
     [java] 	2   CoreFoundation                      0x00007fff914700ad -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
     [java] 	3   CoreFoundation                      0x00007fff913b5e24 ___forwarding___ + 1028
     [java] 	4   CoreFoundation                      0x00007fff913b5998 _CF_forwarding_prep_0 + 120
     [java] 	5   libawt_lwawt.dylib                  0x0000000190759730 Java_sun_lwawt_macosx_CFRetainedResource_nativeCFRelease + 103
     [java] 	6   ???                                 0x000000011451a631 0x0 + 4635862577
     [java] 	7   ???                                 0x000000011450d08d 0x0 + 4635807885
     [java] )
     [java] libc++abi.dylib: terminating with uncaught exception of type NSException
     [java] Java Result: 134

Full log from an automated UI-test: http://tendril.se.oracle.com/admin/requests/taskdetails.do?taskID=4100879

Steps to reproduce:
1. Download and install JDK 9 and the corresponding demos.
2. Start JMC (<JDK_INSTALL_DIR>/jdk/jdk1.9.0.jdk/Contents/Home/lib/missioncontrol/"Java Mission Control").
3. Install the JConsole plugin.
4. Restart JMC (as requested by the plugin installation)
5. Configure the plug-in path to point to <DEMO_INSTALL_DIR>/management/JTop
6. Open a console session on visible JVM.
7. Close the console session and see the JVM crash

If needed, contact erik.greijus@oracle.com to get an already configured JDK/JMC zip-file in order to be able to skip steps 1-5, just unpack, launch JMC and run steps 6-7.

8u60-critical-request: - Justification : All applications which mix swt/fx and awt/swing are broken (for example JMC) - Risk Analysis: I assume that it should be low. - JPRT link: jdk9: http://sthjprt.se.oracle.com/archives/2015/07/2015-07-30-122916.serb.client-work/ jdk8: http://scaaa637.us.oracle.com/archive/2015/07/2015-07-30-124942.serb.jdk8u-work/ - Webrev: http://cr.openjdk.java.net/~serb/8132382/webrev.02/ - Testing (to-be-done) : the tests from JMC-4034 and JDK-8132469 and JDK-8132803. Swing basher, jck, regression. eclipse. - Back ports (to-be-done) : jdk8u60 - FX Impact: fx will crash if swing is used in the same time - Fix For Release: // JDK 8

The threaddump is the same as described here: https://bugs.openjdk.java.net/browse/JDK-8132512

I have JMC hung on connect to application running on this PIT build on Mac OSX 10.10. I attached JMC threaddump. The main thread is blocked

I applied the patch and verified that it fixes the problem with SwingSet2Node

Review: http://mail.openjdk.java.net/pipermail/awt-dev/2015-July/009734.html

I can reproduce the crash on FX by using the Swing dialogs as indicated above.

We don't bundle JMC 6 with JDK8u60 but instead JMC 5.5. (That said, on JDK8u60 there is still a problem running the bundled JMC 5.5 with the JConsole plugin installed. Instead of a crash we get a total lockup of JMC as soon as a connection is made to a JVM.) - This has now been reported as a separate bug.

In the SwingSet2Node open OptionPane demo and "click show warning dialog" a few times.


I ran a few FX apps that use SwingNode to embed Swing into JavaFX (EmbeddedSwing, JFreeChartNode, SwingSet2Node) on JDK 8u60-b25 and don't see any problems. This could be because these programs don't trigger native resource deallocation. Is there something specific I could try to trigger this?

impact: On OSX, all embedding of awt/swing inside other libraries is broken.

In the fix 8068886 the new native resources deallocation code assumes that we have a full control over the Cocoa NSApplication. This is incorrect in case of embedding, when NSApplication is controlled by swt or fx libraries. Potentially FX can be affected also, if fx application inderectly will use some native resources from awt/swing which will require native deallocation.

I can confirm that the same crash happens on 8u60 b25 (when copying JMC 6 with the JConsole plug-in from the JDK 9 directory to 8u60 and performing the steps above)

I assume that jdk8u60 is broken also, please check that. http://jre.sfbay.sun.com/java/re/jdk/8u60/promoted/all/b25/

Regression of 8068886