RFR: 8320534: fatal error for the NMTBenchmark test run for the mainline build
Afshin Zafari
azafari at openjdk.org
Tue Mar 5 14:49:45 UTC 2024
On Tue, 5 Mar 2024 09:08:24 GMT, Afshin Zafari <azafari at openjdk.org> wrote:
>> How does this resolve the bug?
>
>> How does this resolve the bug?
>
> The bug is when the benchmark runs in multi-threaded using command line number of threads. This benchmark handles and controls the thread internally. So, if externally runs with 1+ threads it will throw exception to notify the user.
> @afshin-zafari Still unclear, sorry. Since there is no bug analysis on the issue, could you explain what the bug is, what causes the memory corruption, and how your patch fixes it?
The benchmark (like any other jmh benchmark) can be run from command line. In command line it is possible to set the number of threads that concurrently run every test (method of a Java class) inside the benchmark. In this benchmark, every method creates and manages the threads itself. Simply, there is a THREADS parameter inside the benchmark which accepts values of `{1,2,4,8}` where 1 means single threaded. There is also possible to set the NO-OF-THREADS thru the command line. So, when the benchmark supposed to run with 1 thread but externally the NO-OF-THREADS set to 1+, the program crashes or memory is not safely/correctly shared between threads.
The fix here, reads the NO-OF-THREADS cmd-line arg and if it is not 1, exits the benchmark by throwing an exception.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/17824#issuecomment-1978940751
More information about the hotspot-runtime-dev
mailing list