JDK-8208702 : javax/swing/reliability/HangDuringStaticInitialization.java may hang on macos
  • Type: Bug
  • Component: client-libs
  • Affected Version: 10,11,12
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • CPU: generic
  • Submitted: 2018-08-02
  • Updated: 2019-08-13
  • Resolved: 2018-10-31
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 11 JDK 12
11.0.4Fixed 12 b20Fixed
Related Reports
Relates :  
Description
The new  test which were added for JDK-8189604 may hang on macOS.
The hang is occured when the test executed on the headless system but uses  "-Djava.awt.headless=false" opition, and our toolkit instead of headlessexception hangs.
Comments
Fix Request I see this issue in our nightly testing all the time and would like to get this fixed. The patch applies cleanly. The fix is in 12 for quite a while, so the risk should be low. I run it through our nightly testing.
11-03-2019

The new test which was added as part of JDK-8189604[1] may hang on macOS if it is run via ssh, and the user used in ssh and the current user in GUI login session are different. But it works if the users are the same. ===================== This is part of the spec describe why it works in some cases and does not work in another: "The reasons for this non-obvious behavior are lost in the depths of history. However, the fact that this works at all is pretty much irrelevant because there are important caveats that prevent it from being truly useful." https://developer.apple.com/library/archive/technotes/tn2083/_index.html#//apple_ref/doc/uid/DTS10003794-CH1-SUBSECTION14 Also please take a look to the "Listing 6" in the link above, which describe similar situation. ===================== Note that by default in such environment the java will use the headless toolkit which works fine[2]. But the test forces to use the "headful toolkit" using "-Djava.awt.headless=false", which causes a hang in our Appkit initialization. On unix in the same circumstances we will throw the AWTError[3]. I have implemented the same on macOS. If "Security Context" reports that "sessionHasGraphicAccess" is false and the user requests "headful toolkit" we will throw AWTError. [1] https://bugs.openjdk.java.net/browse/JDK-8189604 [2] http://hg.openjdk.java.net/jdk/client/file/f91e995f6d5c/src/java.base/unix/native/libjava/java_props_md.c#l405 [3] http://hg.openjdk.java.net/jdk/client/file/f91e995f6d5c/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c#l758 [4] https://developer.apple.com/library/archive/technotes/tn2083/_index.html#//apple_ref/doc/uid/DTS10003794-CH1-SUBSECTION19
07-08-2018

Caused by JDK-8025673 which changed the toolkit used in a headless mode from HToolkit to LWCToolkit. http://hg.openjdk.java.net/jdk8/jdk8/jdk/rev/f3c95d961557#l7.41 I guess it was assumed that the removed code is related to the headless mode in X11 toolkit, but in fact it is related to the cocoa based toolkit.
03-08-2018