-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8305352: updateIconImages may lead to deadlock after JDK-8276849 #13263
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
Conversation
👋 Welcome back dcherepanov! A progress list of the required criteria for merging this PR into |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No objections to a safe fix for this, but the app is creating and - more to the point - showing (setVisible) the AWT window on the main thread.
Even for AWT (non-swing) apps, it is recommended to do it on the EDT to avoid threading issues - such as this.
Lots of apps do use the main thread, and have no issues but that's not guaranteed.
I can't find where this is documented .. I do remember it was quite a number of years ago that this advice was first offered.
I suppose you could not create a reliable test for this ? Please add noreg-hard to the bug.
@dimitryc 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:
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 276 new commits pushed to the
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's a good point. If the window is created and later iconifiied (for example) and then this notification comes in, will it be missed ?
Yes, and there was a bug on this a long time ago, but for bureaucratic reasons it got closed. |
Such notifications won't be ignored as isVisible() returns true for iconified windows
|
But it will be ignored if the window is invisible. It is better to fix the https://bugs.openjdk.org/browse/JDK-6995195 |
If we show/hide a window and then change DPI settings, then notifications will be ignored. But as soon as we show the window next time, we'll get new updateGC notification artifically initiated from WWindowPeer.show (https://github.com/openjdk/jdk/blob/master/src/java.desktop/windows/classes/sun/awt/windows/WWindowPeer.java#L287). Later, when the window will be displayed on the screen, it will have the updated icon without delay. It's a low-risk change that fixes the regression and keeps the original scenario working. It looks safe to backport to JDK 20 update.
Created new PR for this issue: #13459 |
I tried to find any documentation stating the threading model for AWT components but I didn't find any. I presume AWT should be thread-safe. A couple of times on code review I saw it had been proposed to drop |
If the window is not visible, |
Then it looks fine. |
Thanks for the reviews. /integrate |
Going to push as commit f968da9.
Your commit was automatically rebased without conflicts. |
Please review this PR which suggests to skip updateIconImages() for not yet visible windows. The displayChanged notification can be sent to a window that is in the process of initiailization and calling updateIconImages() may lead to the deadlock.
Testing: the deadlock no longer happens with this patch. The reg test for JDK-8276849 works (window icon is updated after changing DPI settings).
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/13263/head:pull/13263
$ git checkout pull/13263
Update a local copy of the PR:
$ git checkout pull/13263
$ git pull https://git.openjdk.org/jdk.git pull/13263/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 13263
View PR using the GUI difftool:
$ git pr show -t 13263
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/13263.diff
Webrev
Link to Webrev Comment