RFR: 8337331: crash: pinned virtual thread will lead to jvm crash when running with the javaagent option [v2]

Alan Bateman alanb at openjdk.org
Mon Jul 29 10:12:34 UTC 2024


On Mon, 29 Jul 2024 09:49:11 GMT, Jiawei Tang <jwtang at openjdk.org> wrote:

>> I add the testcase which can reproduce the crash. I hope that I could get some advise if the codes need changing.
>
> Jiawei Tang has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision:
> 
>   8337331: crash: pinned virtual thread will lead to jvm crash when running with the javaagent option

test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadTraceWithAgent/TestPinCaseWithTrace.java line 2:

> 1: /*
> 2:  * Copyright (c) 2024, 2024, Oracle and/or its affiliates. All rights reserved.

I assume you didn't mean to include a date range on a new test.

test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadTraceWithAgent/TestPinCaseWithTrace.java line 66:

> 64:             System.out.println("call native: " + nativeFuncPin(1));
> 65:         });
> 66:     }

Does this really need to use a custom scheduler? If not, the running the test with -Djdk.virtualThreadScheduler.maxPoolSize=1 would be simpler. If you really need a custom scheduler, the test can use jdk.test.lib.thread.VThreadScheduler.  Also to create a pining scenario it can use jdk.test.lib.thread.VThreadPinner. You'll see examples of both in other tests.

test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadTraceWithAgent/TestPinCaseWithTrace.java line 70:

> 68:     static int native2Java(int b) {
> 69:         try {
> 70:             Thread.sleep(500); // try yield, will pin, javaagent+tracePinnedThreads will crash here (because of the class `PinnedThreadPrinter`)

As noted in the JBS issue, -Djdk.tracePinnedThreads has been very problematic and has been removed in the loom repo as part of the object monitor changes.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20373#discussion_r1694938805
PR Review Comment: https://git.openjdk.org/jdk/pull/20373#discussion_r1694941417
PR Review Comment: https://git.openjdk.org/jdk/pull/20373#discussion_r1694942324


More information about the serviceability-dev mailing list