Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8340849

[macos] Crash when creating a child window of a JavaFX window after Platform::exit

XMLWordPrintable

    • b16
    • os_x

      To reproduce, reenable the skipped SwingNodePlatformExitCrashTest in JavaFX and run it. I'll also try to attach a standalone test program.

      This is related to JDK-8190329, which has been fixed in both AWT and (via JDK-8339178) in JavaFX, but has a different root cause.

      As noted in test bug JDK-8340442, there were two separate crashes with two separate, but similar, scenarios.

      * FX toolkit is started first, and thus JavaFX owns the NSApplication: The crash reported in JDK-8190329 (and later cloned by JDK-8339178 on the FX side) only happens in this mode, where the FX toolkit is started first (e.g., if the main class extends javafx.applicationApplication). The crash was a result of shutting down the FX toolkit, which detached the AppKit thread from the JVM and thus invalidated any cached JNI env pointers, and then creating a Swing Dialog, which used the stale JNI env pointer. As noted, this one is now fixed in both FX and AWT.

      * AWT toolkit is started first, and thus AWT owns the NSApplication: This crash is also the result of shutting down the FX toolkit and then creating a Swing Dialog; based on the stack trace, it looks like this crash happens when the AWT dialog tries to create the underlying Window as a child window of the FX window, but the FX parent window pointer is invalid.

      This bug tracks the second of these two crashes.

      NOTE: It is possible that other platforms (e.g., Windows) could have the same problem, although that will need to be tested.


      Steps to reproduce:

      1. Comment out the `@Disabled` statement in SwingNodePlatformExitCrashTest
      2. Run the following:
      gradle sdk shims
      gradle --continue --info -PTEST_ONLY=true -PFULL_TEST=true -PUSE_ROBOT=true :systemTests:test --tests SwingNodePlatformExitCrashTest

      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # SIGSEGV (0xb) at pc=0x000000019d821c34, pid=79001, tid=78087
      #
      # JRE version: Java(TM) SE Runtime Environment (22.0.2+9) (build 22.0.2+9-70)
      # Java VM: Java HotSpot(TM) 64-Bit Server VM (22.0.2+9-70, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, bsd-aarch64)
      # Problematic frame:
      # C [libobjc.A.dylib+0x9c34] objc_msgSend+0x34
      #
      # No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
      #
      # An error report file with more information is saved as:
      # /Users/kcr/dev/javafx/jfx-clean/jfx/rt/tests/system/hs_err_pid79001.log
      [3.933s][warning][os] Loading hsdis library failed
      #
      # If you would like to submit a bug report, please visit:
      # https://bugreport.java.com/bugreport/crash.jsp
      # The crash happened outside the Java Virtual Machine in native code.
      # See problematic frame for where to report the bug.
      #

            psadhukhan Prasanta Sadhukhan
            kcr Kevin Rushforth
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: