JDK-8231558 : [macos] Platform.exit causes assertion error on macOS 10.15 or later
  • Type: Bug
  • Component: javafx
  • Sub-Component: window-toolkit
  • Affected Version: jfx13,8u211
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x_10.15
  • CPU: x86_64
  • Submitted: 2019-09-26
  • Updated: 2024-07-12
  • Resolved: 2021-07-01
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.
JDK 8 Other
8u311Fixed jfx11.0.13Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
To reproduce:

1. Run the attached test case:
$ java --module-path javafx-sdk-13/lib --add-modules javafx.controls HelloSimple

2. Press the "Platform.exit" button

3. BUG: The program will exit, but prints the following assertion error:

Java has been detached already, but someone is still trying to use it at -[GlassViewDelegate dealloc]:/Users/jenkins/workspace/OpenJFX-mac/modules/javafx.graphics/src/main/native-glass/mac/GlassViewDelegate.m:198
0   libglass.dylib                      0x0000000128ba8f92 -[GlassViewDelegate dealloc] + 290
1   libglass.dylib                      0x0000000128baec9c -[GlassView3D dealloc] + 252
2   libobjc.A.dylib                     0x00007fff75e4953a _ZN19AutoreleasePoolPage12releaseUntilEPP11objc_object + 134
3   libobjc.A.dylib                     0x00007fff75e2fc30 objc_autoreleasePoolPop + 175
4   CoreFoundation                      0x00007fff48b144be __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
5   CoreFoundation                      0x00007fff48b143e4 __CFRunLoopDoObservers + 457
6   CoreFoundation                      0x00007fff48ab755b __CFRunLoopRun + 1219
7   CoreFoundation                      0x00007fff48ab6e13 CFRunLoopRunSpecific + 499
8   libjli.dylib                        0x0000000105bff619 CreateExecutionEnvironment + 399
9   libjli.dylib                        0x0000000105bfb75e JLI_Launch + 1354
10  java                                0x0000000105bf0ca9 main + 367
11  libdyld.dylib                       0x00007fff7718b405 start + 1

Comments
Changeset: 6403d674 Author: Kevin Rushforth <kcr@openjdk.org> Date: 2021-07-01 11:14:17 +0000 URL: https://git.openjdk.java.net/jfx/commit/6403d6745578887b7f2ccc10ac02e7cdd04d09c1
01-07-2021

This also happens on macOS 11 (Big Sur). This is a latent bug in the JavaFX glass code that was revealed by an apparent change of behavior in macOS. A few of the object deallocation methods, which are called by the auto-release mechanism, use the standard JNI_MAIN_ENV macro to get the JNI environment, which will print an assertion warning if the JVM has been detached. Since we don't control when the dealloc method is called, we should not be doing an assertion check in those cases. Some of the delloc methods already skip this assertion check, so we need to fix the others.
22-06-2021

I can confirm that this still happens with macOS 10.15 final release (19A583).
08-10-2019

This fails on JDK 8u221 as well (and will fail on earlier releases as well, since there are no changes in this area).
26-09-2019