RFR: 8264760: JVM crashes when two threads encounter the same resolution error [v3]
Wang Huang
whuang at openjdk.java.net
Fri Apr 23 02:44:34 UTC 2021
On Thu, 8 Apr 2021 04:51:01 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> Wang Huang has updated the pull request incrementally with one additional commit since the last revision:
>>
>> add throw exception
>
> test/hotspot/jtreg/runtime/Nestmates/membership/TestNestHostErrorWithMultiThread.java line 38:
>
>> 36: import java.util.concurrent.CountDownLatch;
>> 37:
>> 38: class HostNoNestMember {
>
> Please add a comment describing how this class is replaced with the jcode version, and the difference in that version.
I split this class into a single file `HostNoNestMember.java` as @hseigel suggested and add a comment.
> test/hotspot/jtreg/runtime/Nestmates/membership/TestNestHostErrorWithMultiThread.java line 43:
>
>> 41: }
>> 42:
>> 43: public int foo() {
>
> Please call this "test".
Sure. Thank you.
> test/hotspot/jtreg/runtime/Nestmates/membership/TestNestHostErrorWithMultiThread.java line 53:
>
>> 51: public static void main(String args[]) throws Throwable {
>> 52: TestNestHostErrorWithMultiThread t = new TestNestHostErrorWithMultiThread();
>> 53: t.test();
>
> There is no need to create an instance - just use a static test method.
>
> The test code could be placed directly in main in this case.
Thank you. It will be deleted in next commit.
> test/hotspot/jtreg/runtime/Nestmates/membership/TestNestHostErrorWithMultiThread.java line 62:
>
>> 60: new Thread(() -> {
>> 61: try {
>> 62: latch.await();
>
> Please add a comment:
>
> // Try to have all threads trigger the nesthost check at the same time
Thank you. I will add that in next commit.
> test/hotspot/jtreg/runtime/Nestmates/membership/TestNestHostErrorWithMultiThread.java line 68:
>
>> 66: System.out.println("OK - got expected exception: " + expected);
>> 67: } catch (InterruptedException e) {}
>> 68: }).start();
>
> Please extract the logic to a Runnable so that both threads can use that one runnable rather than duplicating the code.
Thank you for your review. It will be more clear after extracting the logic. I will refact that.
-------------
PR: https://git.openjdk.java.net/jdk/pull/3392
More information about the hotspot-runtime-dev
mailing list