RFR: 8325397: sun/java2d/Disposer/TestDisposerRace.java fails in linux-aarch64
Andrey Turbanov
aturbanov at openjdk.org
Tue Sep 3 09:16:34 UTC 2024
On Thu, 15 Aug 2024 18:22:54 GMT, Viktor Klang <vklang at openjdk.org> wrote:
> My suspicion is that Condition::await() throws before having successfully reacquired the lock, and this exception is swallowed because Lock::unlock() then throws when invoke with an IllegalMonitorStateException as the current thread was not reestablished as the owner.
>
> So this PR is intended to harden the reacquisition of await-ing methods in AQS and AQLS so that instead of throwing they spin-loop trying to reacquire the lock—at least a thread dump would show where the Thread is stuck trying to reacquire.
>
> There's also the option of attempting to log a JFR event on the first reacquisition failure, but that might need to be done with a pre-created event as the cause of the failing acquisition may be an OOME.
>
> I also needed to harden the TestDisposerRace itself, as it currently tries to provoke OOMEs but then proceeds to want to allocate objects used for the test itself. I'm not super-happy about the changes there, but they should be safer than before.
>
> The first RuntimeException/Error encountered will be rethrown upon success to facilitate debugging.
test/jdk/sun/java2d/Disposer/TestDisposerRace.java line 88:
> 86:
> 87: private static <T> T retryOnOOME(Supplier<T> allocator) {
> 88: for(;;) {
nit
Suggestion:
for (;;) {
test/jdk/sun/java2d/Disposer/TestDisposerRace.java line 100:
> 98:
> 99: private static <E extends Exception> void retryOnOOME(ThrowingRunnable<E> tr) throws E {
> 100: for(;;) {
nit
Suggestion:
for(;;) {
test/jdk/sun/java2d/Disposer/TestDisposerRace.java line 117:
> 115: MyDisposerRecord disposerRecord = retryOnOOME(MyDisposerRecord::new);
> 116:
> 117: while(count > 0) {
Suggestion:
while (count > 0) {
test/jdk/sun/java2d/Disposer/TestDisposerRace.java line 117:
> 115: MyDisposerRecord disposerRecord = retryOnOOME(MyDisposerRecord::new);
> 116:
> 117: while(count > 0) {
nit
Suggestion:
while (count > 0) {
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20602#discussion_r1736738246
PR Review Comment: https://git.openjdk.org/jdk/pull/20602#discussion_r1736738799
PR Review Comment: https://git.openjdk.org/jdk/pull/20602#discussion_r1732793046
PR Review Comment: https://git.openjdk.org/jdk/pull/20602#discussion_r1736739470
More information about the core-libs-dev
mailing list