RFR: 8360702: runtime/Thread/AsyncExceptionTest.java timed out
David Holmes
dholmes at openjdk.org
Thu Oct 2 04:05:46 UTC 2025
On Tue, 30 Sep 2025 16:20:11 GMT, Patricio Chilano Mateo <pchilanomate at openjdk.org> wrote:
> Please review this small test fix. To make sure the worker thread receives the async exception at a safe place, we should avoid using synchronization objects where the worker thread might need to unpark the main thread. Otherwise, if the main thread is virtual, the async exception might be set while the worker is still executing FJP code. See JBS comments for more detail.
>
> I fixed test AsyncExceptionOnMonitorEnter.java too and removed it from test/hotspot/jtreg/ProblemList-Virtual.txt. The alternative was to problem list AsyncExceptionTest.java, but I think it’s better if we can just keep the tests for this mode too.
>
> Thanks,
> Patricio
For AsyncExceptionTest.java I have one issue - see below.
Looking at AsyncExceptionOnMonitorEnter.java we seem to be making a number of assumptions based on the fact we only have real platform threads:
1. An async exception is either thrown before we start the monitorenter, or else after we are blocked (is this true? we never used to be able to unblock a monitor acquisition via stop() because the code will still try to unlock it???)
2. We can safely hit `Thread.sleep` with an async exception without breaking anything.
Aside:
> // Don't stop() worker1 with JVMTI raw monitors since if the monitor is not released worker2 will deadlock on enter
Pre-existing but surely the rawMonitorExit should be in a finally block to avoid this problem.
Thanks
test/hotspot/jtreg/runtime/Thread/AsyncExceptionTest.java line 82:
> 80: public void internalRun1() {
> 81: started = true;
> 82: try {
You need to move the setting of `started` to inside the try block else you could throw outside the range of the catch.
-------------
Changes requested by dholmes (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/27582#pullrequestreview-3292062215
PR Review Comment: https://git.openjdk.org/jdk/pull/27582#discussion_r2396634482
More information about the hotspot-runtime-dev
mailing list