RFR(S): 8191229: serviceability/jvmti/GetOwnedMonitorInfo/GetOwnedMonitorInfoTest.java fails with NoClassDefFoundError

Chris Plummer chris.plummer at oracle.com
Thu Dec 7 17:27:53 UTC 2017


On 12/7/17 8:49 AM, Chris Plummer wrote:
> On 12/7/17 2:41 AM, David Holmes wrote:
>> Hi Chris,
>>
>> On 7/12/2017 5:44 PM, Chris Plummer wrote:
>>> New webrev:
>>>
>>> https://bugs.openjdk.java.net/browse/JDK-8191229
>>> http://cr.openjdk.java.net/~cjplummer/8191229/webrev.01/
>>>
>>> testClass now initialized from JNI_OnLoad(), and use memset to clear 
>>> callbacks. Also updated to use JVMTI_VERSION_9 when calling GetEnv().
>>
>> � 71�������� // JNI_OnLoad has not been called yet, so can't possibly 
>> be an instance of TEST_CLASS.
>>
>> You can't be executing this method before JNI_OnLoad has executed. If 
>> JNI_Onload has executed then you can't execute this method and find 
>> NULL as that means JNI_Onload failed and hence library loading fails 
>> and so you can't be executing this method. So this method reduces to 
>> a simple instanceof check, which can go straight into the calling 
>> method.
> That's what I thought, but it was crashing because testClass was NULL. 
> I think Agent_OnLoad() is being called before JNI_OnLoad. I'll add 
> traces and see for sure.
Printfs confirm that (at least in the one run I just did) Agent_OnLoad() 
was called before JNI_OnLoad(). However, I'm not certain that is always 
the case, because before I put the NULL check in, it only crashed 12 out 
of 50 times. 2 of those were on a linux-x64 product build and the rest 
were on the macosx debug build. Debug builds on Windows, solaris, and 
linux were fine. I'm not certain of the call environment for either of 
these functions, but I can at least see that Agent_OnLoad() is called on 
a different thread than JNI_OnLoad(), which is called on the test's main 
thread. So a race is seems possible.

Chris
>
> Chris
>>
>> �183���� if (testClass == NULL) {
>>
>> That can just be "else {" - but as I said it can't be NULL anyway.
>>
>> Thanks,
>> David
>>
>>> thanks,
>>>
>>> Chris
>
>
>




More information about the serviceability-dev mailing list