Integrated: 8289208: Test DrawRotatedStringUsingRotatedFont.java occasionally crashes on MacOS

Maxim Kartashev mkartashev at openjdk.org
Fri Aug 12 15:41:22 UTC 2022


On Mon, 4 Jul 2022 09:31:05 GMT, Maxim Kartashev <mkartashev at openjdk.org> wrote:

> Java2D's `Disposer` maintains a record of objects to dispose of with the help of a collection that isn't thread safe. When `DisposerRecords` objects are being added to it at the same time as others are being disposed on the Toolkit thread, chaos ensues.
> 
> This commit replaces the collection with a thread-safe  one, more consistently guards against exceptions in individual disposers, and adds exception's stacktraces printing in order to facilitate said exceptions' debugging, which are otherwise hard to pinpoint without code modification. 
> 
> Originally, the bug was caught on MacOS running an existing test (`DrawRotatedStringUsingRotatedFont`) that would occasionally crash the VM (probably due to double-free detected by libc that abort()'s in this case). It may take many re-tries to reproduce and this wasn't  observed on Linux. The new test (`test/jdk/sun/java2d/Disposer/TestDisposerRace.java`) displays the problem in a more reliable fashion and fails both on MacOS and Linux without this fix.

This pull request has now been integrated.

Changeset: 00decca4
Author:    Maxim Kartashev <mkartashev at openjdk.org>
Committer: Alexey Ushakov <avu at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/00decca46a77ea9390081655b069008aacfea525
Stats:     141 lines in 3 files changed: 120 ins; 5 del; 16 mod

8289208: Test DrawRotatedStringUsingRotatedFont.java occasionally crashes on MacOS

Reviewed-by: prr, avu

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

PR: https://git.openjdk.org/jdk/pull/9362



More information about the client-libs-dev mailing list