[jdk17u-dev] RFR: 8268364: jmethod clearing should be done during unloading
Kerem Kat
duke at openjdk.org
Mon Sep 9 10:26:12 UTC 2024
On Sun, 8 Sep 2024 11:26:11 GMT, Goetz Lindenmaier <goetz at openjdk.org> wrote:
>> Clean backport of [8268364](https://bugs.openjdk.org/browse/JDK-8268364).
>>
>> It fixes crashes when accessing jmethodIDs of a class being unloaded.
>>
>> Here is the reproducer that crashes JVM in ~1 second without the patch, but works fine with it: [gist](https://gist.github.com/krk/a0800bac5bc5a01709be85637285a965).
>>
>> This fix also resolves the issue reported at https://github.com/async-profiler/async-profiler/issues/974 for Java 17.
>>
>> **Additional testing**: release and fastdebug with `JTREG_KEYWORDS="!headful & !external-dep & !printer"`, no new test failures with the patch.
>>
>> To run the repro:
>>
>>
>> javac Main.java
>> gcc -shared -I"$JAVA_HOME/include" -I"$JAVA_HOME/include/linux" -fPIC repro.cpp -orepro.so
>>
>> java -agentpath:"$(pwd)/repro.so" -Xmx100m Main
>
> Hi @krk,
> thanks for contributing.
> Please provide a useful fix request comment. See also https://wiki.openjdk.org/display/JDKUpdates/How+to+contribute+or+backport+a+fix
> Removed the fix-request tag in the meantime.
> Please also check the GHA check failures. If they are unrealated to your PR, you can tell in a comment that you want to proceed anyways, else I assume you did not check them.
Hi @GoeLin,
Thanks for your input.
I intend to backport this into 11 and 8 too.
GHA failure at [[serviceability/sa/ClhsdbFindPC#id2](https://github.com/krk/jdk17u-dev/actions/runs/10631432422/attempts/3#user-content-serviceability_sa_clhsdbfindpc#id2](https://github.com/krk/jdk17u-dev/actions/runs/10631432422/job/29560140545)) can be seen failing without the patch, e.g. in https://github.com/openjdk/jdk17u-dev/pull/2843#issuecomment-2326533656:
Error: java.lang.RuntimeException: Unable to deduce type of thread from address 0x000000012f808810 (expected type JavaThread, CompilerThread, MonitorDeflationThread, ServiceThread, JvmtiAgentThread or CodeCacheSweeperThread).
This is unrelated to the current PR.
-------------
PR Comment: https://git.openjdk.org/jdk17u-dev/pull/2839#issuecomment-2337731253
More information about the jdk-updates-dev
mailing list