Integrated: 8222884: ConcurrentClassDescLookup.java times out intermittently

Jaikiran Pai jpai at openjdk.org
Wed Jun 12 05:39:19 UTC 2024


On Tue, 11 Jun 2024 13:09:21 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

> Can I please get a review of this test-only change which proposes to address intermittent failures in `test/jdk/java/io/Serializable/concurrentClassDescLookup/ConcurrentClassDescLookup.java`?
> 
> This addresses https://bugs.openjdk.org/browse/JDK-8222884. As noted in that issue, the test in its current form has a potential race. The test main thread launches 50 "successful lookup" tasks and 50 "failed lookup" tasks. Each task is a `Thread`. The test passes an `Object` instance shared by 50 of these tasks and each task when it starts execution in its `run()` method does a `wait()` on that `Object` instance. The test main thread then after launching 50 tasks, sleeps for a second (to let the 50 `Thread`s start execution and arrive at the `Object.wait()`) and then after waking up the main thread does a `notifyAll()` on that `Object` instance. In theory and likely in practice too, it's possible that (especially) for the last batch of 50 tasks (the "failing lookup" tasks), the `notifyAll()` might end up getting invoked before one or more task Thread(s) have actually done a `wait()`. That can then mean that one or more task `Thread`(s) will keep `wait()`ing indefinitely with no on
 e `notify()`ing the `Object` instance to proceed with the task execution.
> 
> The commit in this PR removes the use of `Object.wait()/notifyAll()` and instead uses a `CountdownLatch` to allow for a more deterministic barrier. The test continues to pass with this change. Additionally, this change was run against a CI setup, by Matthias, where it was previously failing intermittently. Matthias reports that it hasn't failed after this change.

This pull request has now been integrated.

Changeset: bd046d9b
Author:    Jaikiran Pai <jpai at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/bd046d9b9e79e4eea89c72af358961ef6e98e660
Stats:     36 lines in 1 file changed: 7 ins; 7 del; 22 mod

8222884: ConcurrentClassDescLookup.java times out intermittently

Reviewed-by: rriggs, mbaesken

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

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


More information about the core-libs-dev mailing list