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

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Sergey Bylokhov
Hello.
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."
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


--
Best regards, Sergey.
Reply | Threaded
Open this post in threaded view
|

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

Sergey Bylokhov
Any volunteers to review? =)

On 06/08/2018 19:06, Sergey Bylokhov wrote:

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


--
Best regards, Sergey.
Reply | Threaded
Open this post in threaded view
|

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

Denis Fokin
Is there a way to avoid the code duplication?

Thank you,
Denis.
On Tue, 30 Oct 2018 at 03:57, Sergey Bylokhov <[hidden email]> wrote:
Any volunteers to review? =)

On 06/08/2018 19:06, Sergey Bylokhov wrote:
> Hello.
> 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."
> 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
>
>


--
Best regards, Sergey.
Reply | Threaded
Open this post in threaded view
|

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

Phil Race
Looks fine.

On 10/29/18 11:02 PM, Denis Fokin wrote:
Is there a way to avoid the code duplication?

You mean the code copied from the launcher ?
Not sure, but it would probably be way more hassle than its worth since
it seems like we'd need to link libawt against the libjli that belongs to the
launcher. That's messing with module boundaries too.

-phil



Thank you,
Denis.
On Tue, 30 Oct 2018 at 03:57, Sergey Bylokhov <[hidden email]> wrote:
Any volunteers to review? =)

On 06/08/2018 19:06, Sergey Bylokhov wrote:
> Hello.
> 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."
> 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
>
>


--
Best regards, Sergey.

Reply | Threaded
Open this post in threaded view
|

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

Sergey Bylokhov
In reply to this post by Denis Fokin
Hi, Denis.
It is not possible to avoid duplication from the implementation point of view, because these two libraries should not depend from each other. It is possible to deduplicate it in the source code, for example by moving this method to some separate header in the java.base and use it from java.desktop. But actually we have a separate goal to remove the client code from launcher. So at some point the code, where isInAquaSession() is used in the launcher, will be removed.

On 29/10/2018 23:02, Denis Fokin wrote:

> Is there a way to avoid the code duplication?
>
> Thank you,
> Denis.
> On Tue, 30 Oct 2018 at 03:57, Sergey Bylokhov <[hidden email] <mailto:[hidden email]>> wrote:
>
>     Any volunteers to review? =)
>
>     On 06/08/2018 19:06, Sergey Bylokhov wrote:
>      > Hello.
>      > 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."
>      > 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
>      >
>      >
>
>
>     --
>     Best regards, Sergey.
>


--
Best regards, Sergey.
Reply | Threaded
Open this post in threaded view
|

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

Denis Fokin
> So at some point the code, where isInAquaSession() is used in the launcher, will be removed.

Great!

On Tue, Oct 30, 2018 at 9:17 PM Sergey Bylokhov <[hidden email]> wrote:
Hi, Denis.
It is not possible to avoid duplication from the implementation point of view, because these two libraries should not depend from each other. It is possible to deduplicate it in the source code, for example by moving this method to some separate header in the java.base and use it from java.desktop. But actually we have a separate goal to remove the client code from launcher. So at some point the code, where isInAquaSession() is used in the launcher, will be removed.

On 29/10/2018 23:02, Denis Fokin wrote:
> Is there a way to avoid the code duplication?
>
> Thank you,
> Denis.
> On Tue, 30 Oct 2018 at 03:57, Sergey Bylokhov <[hidden email] <mailto:[hidden email]>> wrote:
>
>     Any volunteers to review? =)
>
>     On 06/08/2018 19:06, Sergey Bylokhov wrote:
>      > Hello.
>      > 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."
>      > 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
>      >
>      >
>
>
>     --
>     Best regards, Sergey.
>


--
Best regards, Sergey.