Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8305825: getBounds API returns wrong value resulting in multiple Regression Test Failures on Ubuntu 23.04 #16960

Closed
wants to merge 3 commits into from

Conversation

azvegint
Copy link
Member

@azvegint azvegint commented Dec 4, 2023

The root of this issue is the incorrect calculation of window decoration insets.

Previously we got non-zero window insets in the first PropertyNotify with _NET_FRAME_EXTENTS atom, save them and never change them again.

This changed starting with Ubuntu 23.04:
Now we can get several such notifications with zero window insets, and only then the correct value.

Our code is not ready for this. It affects all our JDK. As a result, many tests fail on Ubuntu 23.04 and 23.10.

The solution is to change these insets on the fly, for now only for Mutter window manager.
The guessInsets for it have also been updated.

This also means that some tests need some stabilization as they are not ready for such late arrival of window insets.

Testing looks good.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8305825: getBounds API returns wrong value resulting in multiple Regression Test Failures on Ubuntu 23.04 (Bug - P3)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/16960/head:pull/16960
$ git checkout pull/16960

Update a local copy of the PR:
$ git checkout pull/16960
$ git pull https://git.openjdk.org/jdk.git pull/16960/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 16960

View PR using the GUI difftool:
$ git pr show -t 16960

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/16960.diff

Webrev

Link to Webrev Comment

Sorry, something went wrong.

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 4, 2023

👋 Welcome back azvegint! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@@ -458,6 +458,7 @@ java/awt/Graphics2D/DrawString/RotTransText.java 8316878 linux-all
java/awt/KeyboardFocusmanager/TypeAhead/ButtonActionKeyTest/ButtonActionKeyTest.java 8257529 windows-x64
java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeForModalDialogTest/ConsumeForModalDialogTest.java 8302787 windows-all
java/awt/KeyboardFocusmanager/TypeAhead/MenuItemActivatedTest/MenuItemActivatedTest.java 8302787 windows-all
java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeNextMnemonicKeyTypedTest.java 8321303 linux-all
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This intermittent issue is more reproducible after the fix, however it was there before.
I am able to reproduce it with various JDK 11, 17, 19, 21, 22 (more info and a reproducer is available here)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test has been problematic in the past.
Eg https://bugs.openjdk.org/browse/JDK-8283896

@@ -651,6 +652,7 @@ javax/sound/sampled/Clip/ClipIsRunningAfterStop.java 8307574 linux-x64

javax/swing/plaf/basic/BasicTextUI/8001470/bug8001470.java 8233177 linux-all,windows-all

javax/swing/JFrame/MaximizeWindowTest.java 8321289 linux-all
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test was supposed to fail on Linux, but it didn't because of the misreported size. JDK-8321289

@openjdk
Copy link

openjdk bot commented Dec 4, 2023

@azvegint The following label will be automatically applied to this pull request:

  • client

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added client client-libs-dev@openjdk.org rfr Pull request is ready for review labels Dec 4, 2023
@azvegint azvegint marked this pull request as draft December 4, 2023 23:35
@azvegint azvegint marked this pull request as ready for review December 4, 2023 23:36
@mlbridge
Copy link

mlbridge bot commented Dec 4, 2023

Webrevs

@victordyakov
Copy link

@honkar-jdk @alisenchung @aivanov-jdk please review

@@ -1369,6 +1369,9 @@ Insets guessInsets(XDecoratedPeer window) {
case UNITY_COMPIZ_WM:
res = new Insets(28, 1, 1, 1);
break;
case MUTTER_WM:
res = new Insets(37, 0, 0, 0);
break;
case MOTIF_WM:
case OPENLOOK_WM:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of scope for this fix but in a future fix I think we can get rid of at least
(1) LG3D
(2) OPENLOOK
and very probably
(3) MOTIF
and perhaps also
(4) CDE

They are all obsolete.

@@ -458,6 +458,7 @@ java/awt/Graphics2D/DrawString/RotTransText.java 8316878 linux-all
java/awt/KeyboardFocusmanager/TypeAhead/ButtonActionKeyTest/ButtonActionKeyTest.java 8257529 windows-x64
java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeForModalDialogTest/ConsumeForModalDialogTest.java 8302787 windows-all
java/awt/KeyboardFocusmanager/TypeAhead/MenuItemActivatedTest/MenuItemActivatedTest.java 8302787 windows-all
java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeNextMnemonicKeyTypedTest.java 8321303 linux-all
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test has been problematic in the past.
Eg https://bugs.openjdk.org/browse/JDK-8283896

@openjdk
Copy link

openjdk bot commented Dec 6, 2023

@azvegint This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8305825: getBounds API returns wrong value resulting in multiple Regression Test Failures on Ubuntu 23.04

Reviewed-by: prr, achung, honkar, aivanov

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 59 new commits pushed to the master branch:

  • 75a7c19: 8315827: Kitchensink.java and RenaissanceStressTest.java time out with jvmti module errors
  • 91ffdfb: 8320365: IPPPrintService.getAttributes() causes blanket re-initialisation
  • 50baaf4: 8321013: Parallel: Refactor ObjectStartArray
  • afb8964: 8320443: [macos] Test java/awt/print/PrinterJob/PrinterDevice.java fails on macOS
  • 82796bd: 8320570: NegativeArraySizeException decoding >1G UTF8 bytes with non-ascii characters
  • 781775d: 8321484: Make TestImplicitlyDeclaredClasses release independent
  • b02fc86: 8321122: Shenandoah: Remove ShenandoahLoopOptsAfterExpansion flag
  • 2830dd2: 8321410: Shenandoah: Remove ShenandoahSuspendibleWorkers flag
  • f482260: 8319969: os::large_page_init() turns off THPs for ZGC
  • 3edc24a: 8321073: Defer policy of disabling annotation processing by default
  • ... and 49 more: https://git.openjdk.org/jdk/compare/65be5e0c547d74ca7de288b164aa9bd6d6855685...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Dec 6, 2023
@@ -1369,6 +1369,9 @@ Insets guessInsets(XDecoratedPeer window) {
case UNITY_COMPIZ_WM:
res = new Insets(28, 1, 1, 1);
break;
case MUTTER_WM:
res = new Insets(37, 0, 0, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did you come up with the numbers for these insets?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are obtained from the system, and are a default value for the Gnome shell (which uses Mutter WM).
You can get them with window.getInsets().

Copy link
Contributor

@honkar-jdk honkar-jdk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on Ubuntu 23.04 with X11. Code and test changes look good.
Minor: Copyright year needs to be updated for few test files.

@azvegint
Copy link
Member Author

azvegint commented Dec 7, 2023

/integrate

@openjdk
Copy link

openjdk bot commented Dec 7, 2023

Going to push as commit 632a3c5.
Since your change was applied there have been 59 commits pushed to the master branch:

  • 75a7c19: 8315827: Kitchensink.java and RenaissanceStressTest.java time out with jvmti module errors
  • 91ffdfb: 8320365: IPPPrintService.getAttributes() causes blanket re-initialisation
  • 50baaf4: 8321013: Parallel: Refactor ObjectStartArray
  • afb8964: 8320443: [macos] Test java/awt/print/PrinterJob/PrinterDevice.java fails on macOS
  • 82796bd: 8320570: NegativeArraySizeException decoding >1G UTF8 bytes with non-ascii characters
  • 781775d: 8321484: Make TestImplicitlyDeclaredClasses release independent
  • b02fc86: 8321122: Shenandoah: Remove ShenandoahLoopOptsAfterExpansion flag
  • 2830dd2: 8321410: Shenandoah: Remove ShenandoahSuspendibleWorkers flag
  • f482260: 8319969: os::large_page_init() turns off THPs for ZGC
  • 3edc24a: 8321073: Defer policy of disabling annotation processing by default
  • ... and 49 more: https://git.openjdk.org/jdk/compare/65be5e0c547d74ca7de288b164aa9bd6d6855685...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Dec 7, 2023
@openjdk openjdk bot closed this Dec 7, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Dec 7, 2023
@openjdk
Copy link

openjdk bot commented Dec 7, 2023

@azvegint Pushed as commit 632a3c5.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@mrserb
Copy link
Member

mrserb commented Dec 7, 2023

Did you check that these empty values are actually correct? I mean the empty insets are actually real insets of the window which later changed to the correct one? Maybe we should report this upstream?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client client-libs-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

None yet

7 participants