RFR: 8359131: JShell AbstractStopExecutionTest does not stop reliably
Archie Cobbs
acobbs at openjdk.org
Tue Jun 10 14:29:07 UTC 2025
The JShell regression test support class `AbstractStopExecutionTest.java` provides code that starts a JShell evaluation in one thread and then invokes `JShell.stop()` to interrupt that evaluation from another thread.
This class uses a `boolean` field to synchronize the action between threads. However, this field is not marked `volatile` and so the communication is unreliable. As a result, in rare cases, the test can fail due to a timeout.
The simple fix is to make the field `volatile`. This has been verified in testing to resolve the problem (see discussion in [JDK-8355323](https://bugs.openjdk.org/browse/JDK-8355323)).
-------------
Commit messages:
- Mark racy field volatile.
Changes: https://git.openjdk.org/jdk/pull/25730/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25730&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8359131
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/25730.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/25730/head:pull/25730
PR: https://git.openjdk.org/jdk/pull/25730
More information about the kulla-dev
mailing list