CDS and JVM-TI agent questions and crash

Ioi Lam ioi.lam at oracle.com
Wed Oct 17 23:54:06 UTC 2018


Hi Michael & Volker,


Thanks for the bug report and the initial investigation!

Following Volker's investigation, I tried to make a less drastic fix
(than the "nuclear option" of disable CDS entirely), but run into a lot of
issues when class-file-load-hook is specified:


1. The shared heap objects are mapped at JVM start-up. At this
point, we don't know if any of the archived object's class may
be replaced by the CFLH.

2. If java.lang.{Object, Cloneable, Serializable} are replaced
by CFLH, we cannot use the archived primitive arrays.

3. There's a lot of code that assumes if UseSharedSpaces==true,
certain InstanceKlasses must be loaded from CDS. E.g.,
    JavaClasses::compute_offsets() does nothing if UseSharedSpaces==true,
    because it assumes that offsets calculated during dump time will match
    the class loaded at runtime.


I have developed a jtreg test case for this, and attempted to do a
less drastic fix, but I am nowhere near done and it's already messy:

http://cr.openjdk.java.net/~iklam/jdk12/8212200-cds-jvmti-clfh-critical-classes.v00/


Instead, I think we should do this:

http://cr.openjdk.java.net/~iklam/jdk12/8212200-cds-jvmti-clfh-critical-classes.v01/


I will test the patch (probably some old tests may fail because they assumed
that CDS can be enabled when CFLH is in use). I'll post a formal RFR 
afterwards.

I'll also see if it's possible to allow CDS if 
can_generate_early_class_hook_events==false.
I am not entirely sure if all classes affected by UseSharedSpaces are all
loaded in the "early" stage.

We can try the "messy" fix later, if we have more time to get it right.


Thanks
- Ioi


On 10/15/2018 03:35 PM, Jiangli Zhou wrote:
> On 10/15/18 3:30 PM, Michael Rasmussen wrote:
>
>>> One simple alternative fix is to disable sharing when some events (like
>>> CFLH) were enabled. This in fact was the behavior before JDK 9. In JDK
>>> 9, we enabled CDS for debugging. Looks like there are corner cases that
>>> are not uncovered by our testing. I'd like to seek opinions and 
>>> feedback
>>> on the importance of supporting debugging with CDS enabled.
>> Or at least CFLH together with can_generate_all_class_hook_events and 
>> can_generate_early_class_hook_events capabilities.
>>
>> CDS hasn't been part of our own testing scenarios so far, which is 
>> why we haven't notice these issues on our end before now.
>> We only just discovered it because of user reports about crashes, 
>> which turned out to be because the java-11-openjdk package on Fedora 
>> comes with pre-generated CDS archive.
>>
>> But especially with JEP 341 just around the corner, it makes it very 
>> important to find and weed out these bugs now!
>
> Totally agree. These issues are now more important with the default 
> CDS archive. Thanks for reporting them!
>
> Best regards,
> Jiangli
>>
>> /Michael
>



More information about the hotspot-dev mailing list