RFR: 8364434: Inconsistent BufferedContext state after GC [v5]

Alexander Zvegintsev azvegint at openjdk.org
Tue Aug 12 15:34:13 UTC 2025


On Tue, 12 Aug 2025 12:00:37 GMT, Nikita Gubarkov <ngubarkov at openjdk.org> wrote:

>> For "true" null objects, reset the ref itself to null. Non-null ref with null content means that the object was GC'ed. GC'ed state always behaves as not-equal to the new one, causing corresponding ops to be written into RQ.
>> 
>> Although I could not find practical scenarios where refs other than `validPaintRef` could cause problems, this is generally fragile and potentially problematic for any state object kept in weak ref. Therefore I changed the usage of all weak refs in the same way.
>
> Nikita Gubarkov has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8364434: Inconsistent BufferedContext state after GC
>   
>   Skip the test if Color was not GC'ed

test/jdk/java/awt/ColorClass/WeakColorTest.java line 39:

> 37:  * @summary Check that garbage-collecting Color before accelerated painting is complete does not cause artifacts.
> 38:  * @library /test/lib
> 39:  * @run main/othervm -Xms16m -Xmx16m WeakColorTest

I tried 3 different pipelines on Linux:


 * @run main/othervm -Xms16m -Xmx16m -Dsun.java2d.opengl=false -Dsun.java2d.xrender=false WeakColorTest
 * @run main/othervm -Xms16m -Xmx16m -Dsun.java2d.opengl=true -Dsun.java2d.xrender=false WeakColorTest
 * @run main/othervm -Xms16m -Xmx16m -Dsun.java2d.opengl=false -Dsun.java2d.xrender=true WeakColorTest // default


OGL is the only one using the `BufferedContext`.
It passes on SW, and OGL pipelines, the test is skipped on Xrender (the default pipeline).
The results are the same with or without the fix.

As we know that the test is always skipped on Linux on the default pipeline, shouldn't we just just do not run it with ` @requires (os.family != "linux")` to save some CI resources?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/26576#discussion_r2270267348


More information about the client-libs-dev mailing list