RFR: 8243290: Improve diagnostic messages for class verification and redefinition failures

Poonam Parhar poonam.bajaj at oracle.com
Wed Jun 10 13:06:40 UTC 2020


Hello Harold,

Thanks for your review! I fixed the null string issue, and here's the 
updated webrev:
http://cr.openjdk.java.net/~poonam/8243290/webrev.01/

Thanks,
Poonam

On 6/9/20 8:38 AM, Harold Seigel wrote:
> Hi Poonam,
>
> Thanks for making this change.
>
> In verifier.cpp, if ex_msg is NULL, will the call to st->print_cr() at 
> line 142 - 143, fail?
>
> Thanks, Harold
>
> On 6/9/2020 10:46 AM, Poonam Parhar wrote:
>> Hello,
>>
>> Please review this simple change for improving diagnostics around 
>> class verification and linking failures:
>>
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8243290
>> Webrev: http://cr.openjdk.java.net/~poonam/8243290/webrev.00/
>>
>> Problem: During the class redefinition process, if a class 
>> verification fails because it could not find a class referenced in 
>> the class being redefined, the printed NoClassDefFoundError error 
>> message is not very helpful. It does not print the class name for 
>> which NoClassDefFoundError was encountered, and that makes it very 
>> hard to find the real cause of redefinition failure.
>>
>> The proposed solution prints the class name during class linking and 
>> verification failures. Example output produced with these changes:
>>
>> With 'redefine' tag:
>>
>>      [java] [3.243s][debug][redefine,class,load        ] loaded 
>> name=org.apache.commons.logging.impl.Jdk14Logger (avail_mem=819540K)
>>      [java] [3.243s][debug][redefine,class,load        ] loading 
>> name=org.apache.commons.logging.impl.Log4JLogger kind=101 
>> (avail_mem=819540K)
>>      [java] [3.244s][info ][redefine,class,load,exceptions] 
>> link_class exception: 'java/lang/NoClassDefFoundError 
>> org/apache/log4j/Priority'
>>      [java] Java Result: 1
>>
>> With 'verification' tag:
>>
>>      [java] [49.702s][info ][verification] Verification for 
>> org.apache.commons.logging.impl.Log4JLogger has exception pending 
>> 'java.lang.NoClassDefFoundError org/apache/log4j/Priority'
>>      [java] [49.702s][info ][verification] End class verification 
>> for: org.apache.commons.logging.impl.Log4JLogger
>>
>>
>> Improved error message:
>>
>>      [java] Exception in thread "main" java.lang.InternalError: class 
>> redefinition failed: invalid class
>>      [java]     at 
>> java.instrument/sun.instrument.InstrumentationImpl.retransformClasses0(Native 
>> Method)
>>      [java]     at 
>> java.instrument/sun.instrument.InstrumentationImpl.retransformClasses(InstrumentationImpl.java:167)
>>      [java]     at Main.main(Unknown Source)
>>
>>
>> Thanks,
>> Poonam
>>



More information about the hotspot-runtime-dev mailing list