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

Sergey Bylokhov serb at openjdk.org
Wed Jul 13 09:07:42 UTC 2022


On Mon, 11 Jul 2022 10:01:18 GMT, Maxim Kartashev <mkartashev at openjdk.org> wrote:

> will be executed on the disposer thread simultaneously with the array relocation of `deferredRecords`. So some of the `get()` calls will return `null` as they read from initialized, but yet-to-be-relocated chunks, and some will read what essentially is garbage.

Don't we have a similar issue in the usage of `records `and `queue`? Is it possible that the `target` object in the `add `method will be deallocated before `ref `will be added to the `records`? In that case, the next code in `run` method will fail:

    Reference<?> obj = queue.remove();
    obj.clear();
    DisposerRecord rec = records.remove(obj);
    rec.dispose();

Do we need Reference.reachabilityFence at the end of the `add` or some kind of synchronization?

Note that pollRemove tries to solve that:

    DisposerRecord rec = records.remove(obj);
    if (rec == null) { // shouldn't happen, but just in case.
         continue;
    }

But for sure synchronization should solve that in some better way.

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

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



More information about the client-libs-dev mailing list