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

Jiawei Tang jwtang at openjdk.org
Thu Aug 8 08:49:34 UTC 2024


On Thu, 8 Aug 2024 04:43:19 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> I am not too sure adding the `@build jdk.test.lib.Utils` is a good thing. This test definition nor the test code uses/references that class. So it's odd to be adding a build tag for an indirect dependent class (and only that specific class). I felt the `@clean jdk.test.lib.util.JavaAgentBuilder` would be a better option since that `jdk.test.lib.util.JavaAgentBuilder` class is being used by the test definition.
>> 
>> Having said that, it's just a personal opinion and I would let hotspot and serviceability area members to decide what approach to use here. So I would suggest you wait to hear from them before changing anymore.
>
> Building a test library class not actually used by the test is certainly somewhat odd. I wasn't aware of the `@clean` workaround but I see a lot of vmTestbase tests use it, so please try the `@clean` as Jai suggested. Thanks

`@clean jdk.test.lib.util.JavaAgentBuilder` cannot solve the problem. 
I find that the reason why `AgentWithVThreadTest.java` can pass is that when compiling `AgentWithVThread.java`, it uses jdk.test.lib.Utils through `import` (`import jdk.test.lib.process.ProcessTools;`, `import jdk.test.lib.Utils;` is in the ProcessTools.java), so the test dir contains jdk.test.lib.Utils. However, my new testcase doesn't use it. 
<img src=https://github.com/user-attachments/assets/cd80f76e-24b4-463b-bcfd-4b4ba32374cd width=300 />

I tryed add `import jdk.test.lib.Utils;` in my testcase, it can pass.
<img src=https://github.com/user-attachments/assets/cfb10e17-23ae-47f4-b0da-e107fe06c711 width=400 />


If I only run the new testcase, it can pass and the work dir look like this:
<img src=https://github.com/user-attachments/assets/ade018b0-c0b0-4675-b3a0-784b4ef82b78 width=300 />

If I run `AgentWithVThread.java` and then `TestPinCaseWithCFLH.java`, the Utils.class is missed in test/lib/jdk/test/lib:
<img src=https://github.com/user-attachments/assets/83dd910c-ff61-4c06-9ccc-256b2d0ccf1f width=300 />

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20373#discussion_r1708962292


More information about the hotspot-dev mailing list