[JVMTI]Run error with SetFieldModificationWatch on every field in SPECJBB2005

=?GB2312?B?wO69oQ==?= johnnylj98 at gmail.com
Sat Jul 10 18:48:17 PDT 2010


Hi all,
    I've run OpenJDK1.6 on Fedora10 with a JVMTI which watch every field
access. The field modification callback method simply return and do nothing.
But OpenJDK randomly throw a bug like this:

*Start User Threads
  started user thread for Warehouse 1
  started user thread for Warehouse 2
  started user thread for Warehouse 3
Timing Measurement began Sun Jul 11 09:10:48 CST 2010 for 4 minutes
#
# An unexpected error has been detected by Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00f0ec91, pid=10295, tid=5340048
#
# Java VM: OpenJDK Server VM (1.6.0_0-b12 mixed mode linux-x86)
# Distribution: Custom build (Mon Oct 27 16:16:00 EDT 2008)
# Problematic frame:
# V  [libjvm.so+0x471c91]
#
# An error report file with more information is saved as:
# /media/_home/lijian/specjbb2005/dist/hs_err_pid10295.log
#
# If you would like to submit a bug report, please include
# instructions how to reproduce the bug and visit:
#   **http://java.sun.com/webapps/bugreport/crash.jsp*<http://java.sun.com/webapps/bugreport/crash.jsp>
*#
Aborted
*
Any one can help me with this internal bug? I'll be very appreciate!
*
*

Here's my JVMTI source code:

*static void JNICALL
FieldModifyCallBack(jvmtiEnv *jvmti_env,
                        JNIEnv* jni_env,
            jthread thread,
            jmethodID method,
            jlocation location,
            jclass field_klass,
            jobject object,
            jfieldID field,
            char signature_type,
            jvalue new_value)*
*{*
*    //do nothing*
*}*

*static void JNICALL
ClassPrepareCallback(jvmtiEnv *jvmti_env,
            JNIEnv* jni_env,
            jthread thread,
            jclass klass)
{
        jint field_num;
        jfieldID * fieldIDs;
        jvmtiError error = jvmti_env->GetClassFields(klass, &field_num,
&fieldIDs);*
*        if(error != JVMTI_ERROR_NONE)
                fprintf(stderr, "!!!%d\n", error);
        for(int i=0; i< field_num;i++)
        {*
*                error =
jvmti_env->SetFieldModificationWatch(klass,fieldIDs[i]);
                if(error != JVMTI_ERROR_NONE)
                        fprintf(stderr, "!!!\n");
        }
        error = jvmti_env->Deallocate((unsigned char*)fieldIDs);
        if(error != JVMTI_ERROR_NONE)
                fprintf(stderr, "!!!\n");*
*}*

*JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void
*reserved)
{
        static jvmtiEnv *jvmti = NULL;
        static jvmtiCapabilities capa;
        jvmtiError error;

        jint ret = (jvm)->GetEnv((void **)(&jvmti), JVMTI_VERSION_1_0);
        (void)memset(&capa, 0, sizeof(jvmtiCapabilities));
        capa.can_generate_field_modification_events = 1;
        error = jvmti->AddCapabilities(&capa);
        if(error != JVMTI_ERROR_NONE)
                        fprintf(stderr, "!!!\n");*
*        error = jvmti->SetEventNotificationMode(JVMTI_ENABLE,
                JVMTI_EVENT_CLASS_PREPARE, (jthread)NULL);
        if(error != JVMTI_ERROR_NONE)
                fprintf(stderr, "!!!\n");
        error = jvmti->SetEventNotificationMode(JVMTI_ENABLE,
                        JVMTI_EVENT_FIELD_MODIFICATION, NULL);
        if(error != JVMTI_ERROR_NONE)
                fprintf(stderr, "!!!\n");

        jvmtiEventCallbacks callbacks;
        (void)memset(&callbacks, 0, sizeof(callbacks));*
*        callbacks.ClassPrepare= &ClassPrepareCallback;
        callbacks.FieldModification = &FieldModifyCallBack;
        error =
jvmti->SetEventCallbacks(&callbacks,(jint)sizeof(callbacks));
        if(error != JVMTI_ERROR_NONE)
                fprintf(stderr, "!!!\n");

        return JNI_OK;
}
*
*JNIEXPORT void JNICALL Agent_OnUnload(JavaVM *jvm)
{*
*        return;
}*

Here's my openJDK version:

*[root at localhost dist]# java -versionjava version "1.6.0_0"
IcedTea6 1.3.1 (6b12-Fedora-10) Runtime Environment (build 1.6.0_0-b12)
OpenJDK Server VM (build 1.6.0_0-b12, mixed mode)*
**
The attachment is *hs_err_pid10295.log*


Thanks a lot!
-- 
Li jian
China
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/hotspot-dev/attachments/20100711/425110ba/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hs_err_pid10295.log
Type: application/octet-stream
Size: 15299 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/hotspot-dev/attachments/20100711/425110ba/attachment-0001.obj 


More information about the hotspot-dev mailing list