RFR: 8284303: runtime/Thread/AsyncExceptionTest.java timed out

Vladimir Kozlov kvn at openjdk.java.net
Tue Apr 5 21:15:43 UTC 2022


On Mon, 4 Apr 2022 21:16:19 GMT, Patricio Chilano Mateo <pchilanomate at openjdk.org> wrote:

> Please review this small fix to test runtime/Thread/AsyncExceptionTest.java. On rare cases the methods never reach the desired compilation level so the worker thread just gets blocked and the test times out.
> I added a bail out after a couple of seconds of waiting.
> Was able to reproduce the issue and checked the test doesn't timeout anymore with the fix.
> 
> Thanks,
> Patricio

The test is very non-deterministic. Depending on CPU speed and other factors `thread.stop` may arrive at any time (compilation is not blocking from what I see).
Do you want to test it when methods in Interpreter, compiled by C1 or C2, or all these cases? Then you need to test each such case separately and not depend on luck. You can do it by requiring present of C1 and C2 (or simply looking what compilation levels are available). And then run testing thread with different compilation level (including 0 - Interpreter) to make sure `Thread.stop` is delivered in all modes (if that is what you are looking for).

Why you included compilation request into testing thread? You can precompile methods in main() so you don't need to check it during testing time and use `receivedThreadDeathinInternal2` and `realRun`. There are WB API for compiling methods instead of calling them in loop.

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

PR: https://git.openjdk.java.net/jdk/pull/8097


More information about the hotspot-runtime-dev mailing list