RFR: 6995195: Static initialization deadlock in sun.java2d.loops.Blit and GraphicsPrimitiveMgr [v4]

Sergey Bylokhov serb at openjdk.org
Fri Apr 21 21:26:46 UTC 2023


On Mon, 17 Apr 2023 08:14:13 GMT, Dmitry Cherepanov <dcherepanov at openjdk.org> wrote:

>> This PR suggests to move generalPrimitives array to a new static nested GeneralPrimitives class to eliminate the possible deadlock. The Blit class (and other classes that register as general primitives) calls to GeneralPrimitives.register from the static initializer block without acquiring lock on the GraphicsPrimitiveMgr class.
>> 
>> This PR also includes a jtreg regression test which reproduces this issue without the patch and passes with the patch. Running tests from test/jdk/sun/java2d didn't reveal any issues with this patch.
>
> Dmitry Cherepanov has updated the pull request incrementally with one additional commit since the last revision:
> 
>   fixed long lines

Marked as reviewed by serb (Reviewer).

src/java.desktop/share/classes/sun/java2d/loops/GraphicsPrimitiveMgr.java line 258:

> 256:          * @param gen the graphics primitive to be registered as the general loop
> 257:          */
> 258:         static synchronized void register(GraphicsPrimitive gen) {

The change looks fine, but it seems we have a good opportunity here to change all that synchronized methods to read/write locks.

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

PR Review: https://git.openjdk.org/jdk/pull/13459#pullrequestreview-1396412580
PR Review Comment: https://git.openjdk.org/jdk/pull/13459#discussion_r1174171201



More information about the client-libs-dev mailing list