8388508: [macOS] MenuItem graphics in the system menu bar is corrupted or disappears, or JVM crashes in CoreGraphics, under memory pressure - #2219
Conversation
|
👋 Welcome back jpereda! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
|
The total number of required reviews for this PR has been set to 2 based on the presence of this label: |
|
I could easily reproduce the bug in the master branch and this PR fixes it. Linux and Windows also copy the data (it's deferred on Windows but it does get copied). The reference counting in this PR looks correct and overall the code looks good. I think there's an existing bug which leaks one of these NSImages. In GlassPasteboard.m look for jPixelsAttachData (currently on line 270). The NSImage created there is not released and since it's created using |
|
Thanks @beldenfox. As you say, GlassPasteboard creates a While the fix for this leak would be really small (just adding |
Yeah, we should probably treat this as a separate bug even though the fix is so small. |
Yes, please. Can one of you file a new bug for this? |
|
I can do it |
|
I've filed https://bugs.openjdk.org/browse/JDK-8388786 for the |
This PR creates a native owned copy of the pixel buffer passed to GlassPixels::getImage, to let AppKit start, at any later time, the rasterization of the images for the system menu bars with a native object that outlives the Java buffer. Therefore, if under certain conditions of high memory pressure, the latter is reclaimed and collected, the former is still available.
A manual test has been included.
Since this is a memory pressure/timing issue, it is not deterministic, and depends on several conditions. Therefore, it needs to be run several times to spot the issue (before the proposed fix). After the fix, the issue should never happen again.
When running it from
tests/manual/systemmenu, with:it might not trigger the crash, but still the icons might be missing or garbled most of the runs.
However, with:
the crash is more likely to happen in different runs.
Other options to increase the likelihood of failure is to use a low Xmx, or to increase the
COUNTERvalue.Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/2219/head:pull/2219$ git checkout pull/2219Update a local copy of the PR:
$ git checkout pull/2219$ git pull https://git.openjdk.org/jfx.git pull/2219/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 2219View PR using the GUI difftool:
$ git pr show -t 2219Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/2219.diff
Using Webrev
Link to Webrev Comment