<AWT Dev> [12] Review Request: 8208702 javax/swing/reliability/HangDuringStaticInitialization.java may hang on macos

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Tue Aug 7 02:06:31 UTC 2018

Please review the fix for jdk12.

Bug: https://bugs.openjdk.java.net/browse/JDK-8208702
Webrev: http://cr.openjdk.java.net/~serb/8208702/webrev.01

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."

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

Best regards, Sergey.

More information about the awt-dev mailing list