[jdk16u] RFR: 8267345: VM crashes during dumping classlist with -Xshare:dump option
Yumin Qi
minqi at openjdk.java.net
Wed May 19 23:25:59 UTC 2021
On Wed, 19 May 2021 21:11:50 GMT, Ioi Lam <iklam at openjdk.org> wrote:
>> Hi, Please review
>> The problem is caused by JDK-8247536: Support for pre-generated java.lang.invoke classes in CDS static archive
>> Usually the dump with an appointed class list file, -XX:SharedClassListFile=<classlist>, the 'classlist' is collected by pre-run the application with -XX:DumpLoadedClassList, so it is rare case using -Xshare:dump and -XX:DumpLoadedClassList together, though we can do that.
>> It is reproducible by run
>> java -Xshare:dump -XX:DumpLoadedClassList=<any valid file name>
>> The problem happened when regenerating lambda form invoker's holder classes, with which the re-generated class stream without a source associated (class is generated on fly). Referencing to NULL source failed. Fix checks if source is valid.
>>
>> Tests: tier1,tier2,tier3,tier4
>>
>> Thanks
>> Yumin
>
> src/hotspot/share/oops/instanceKlass.cpp line 4244:
>
>> 4242: // These classes can't be loaded from the archive during runtime.
>> 4243: if (!stream->from_boot_loader_modules_image() &&
>> 4244: (stream->source() == NULL || strncmp(stream->source(), "jrt:", 4) != 0)) {
>
> I think the following block on line 4256 should also be changed
>
> if (skip && stream->source() != NULL) {
> tty->print_cr("skip writing class %s from source %s to classlist file",
> name()->as_C_string(), stream->source());
> } else {
In fact, the printout (no change) like:
skip writing class java/lang/invoke/BoundMethodHandle$Species_LL from source (null) to classlist file
skip writing class java/lang/invoke/BoundMethodHandle$Species_LLL from source (null) to classlist file
skip writing class java/lang/invoke/BoundMethodHandle$Species_LLLL from source (null) to classlist file
So C++ can handle the NULL arg well in printf. I am not sure if all platforms handle this way, so will change to "(null)":
stream->source() != NULL ? stream->source() : "(null)"
-------------
PR: https://git.openjdk.java.net/jdk16u/pull/119
More information about the jdk-updates-dev
mailing list