Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4345208

ArcTest applet with JVM/DI agent crashes VM

XMLWordPrintable

    • beta3
    • generic, x86, sparc
    • generic, linux, solaris, solaris_7, solaris_8, windows_nt
    • Verified



      Name: stC104175 Date: 06/13/2000


      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HitSpot(TM) Client VM (build 1.3.0-C, mixed mode)

      ?@HotSpot Virtual Machine(JDK1.3.0C FCS) cause an EXCEPTION_ACCESS_VIOLATION
      error during using JVMDI.

        HotSpot Virtual Machine(JDK1.3.0C FCS) reports the following error.

      #
      # HotSpot Virtual Machine Error, EXCEPTION_ACCESS_VIOLATION
      # Please report this error at
      # http://java.sun.com/cgi-bin/bugreport.cgi
      #
      # Error ID: 4F533F57494E13120E43505002D4
      #

        The above error is occured when JDK's demo applet (ArcTest) is invoked by
      following command options:

      set CLASSPATH=.;
      appletviewer -J-Xdebug -J-Xnoagent -J-Xruntrace example1.html

        Sample program is below:

        trace.dll : A dll which calls JVMDI. Which is located in PATH.
        trace.c : c source file of trace.dll
        trace.h : header file which is used by trace.c


      trace.c
      :---------------------------------------------------------------------------

      #include <jvmdi.h>
      #include <crtdbg.h>

      #include "trace.h"

      /* global jvmdi interface pointer */
      static JVMDI_Interface_1 *jvmdi_interface_1;

      /* function for handling event notification */
      void notifyEvent(JNIEnv *env,JVMDI_Event *event) {
        switch(event->kind) {
        case JVMDI_EVENT_METHOD_ENTRY:
      trace_method(env,event,TRACE_METHOD_ENTER); /* */
          break;
        case JVMDI_EVENT_METHOD_EXIT:
      trace_method(env,event,TRACE_METHOD_RETURN); /* */
          break;
        }
      }

      /* profiler agent entry point */
      #ifdef __cplusplus
      extern "C" {
      #endif
        JNIEXPORT jint JNICALL JVM_OnLoad(JavaVM *jvm, char *options, void *reserved)
      {
          fprintf(stderr, "tracemethod> initializing ..... \n");
          
          /* get jvmdi interface pointer */
          if (((*jvm)->GetEnv(jvm,(void **)&jvmdi_interface_1, JVMDI_VERSION_1)) < 0)
      {
            fprintf(stderr, "myprofiler> error in obtaining jvmdi interface
      pointer\n");
            return JNI_ERR;
          }

          /* set event hook */
          jvmdi_interface_1->SetEventHook(notifyEvent);
          
          // enabling class load event notification
          jvmdi_interface_1->SetEventNotificationMode(JVMDI_ENABLE
      ,JVMDI_EVENT_METHOD_ENTRY, NULL);
          jvmdi_interface_1->SetEventNotificationMode(JVMDI_ENABLE
      ,JVMDI_EVENT_METHOD_EXIT, NULL);

          fprintf(stderr, "tracemethod> .... ok \n\n");
          return JNI_OK;
        }
      #ifdef __cplusplus
      }
      #endif


      void
      trace_method(JNIEnv *env,JVMDI_Event *event, int type)
      {
      jvmdiError err;
      JVMDI_thread_info threadInfo;
      jthread thread = event->u.frame.thread;
      jclass clazz = event->u.frame.clazz;
      jmethodID method = event->u.frame.method;
      jframeID frame = event->u.frame.frame;



      err = jvmdi_interface_1->GetThreadInfo(thread, &threadInfo); /* */
      if(err != JVMDI_ERROR_NONE)
      { /* */
      printf("GetThreadInfo
      failed!\n"); /* */
      exit(-1);
      /* */
      }
      /* */
      #ifdef DEBUG
      debug("GetThreadInfo passed"); /* */
      #endif


      /* clean-up sectoin */


      jvmdi_interface_1->Deallocate(threadInfo.name);

      #ifdef DEBUG
      debug("Deallocate passed");
      #endif

      (*env)->DeleteGlobalRef(env,threadInfo.thread_group); /* */
      (*env)->DeleteGlobalRef(env,threadInfo.context_class_loader); /* */

      }

      #ifdef DEBUG
      void debug(char *str) {
      fprintf(stderr,"%s\n",str);
      fflush(stderr);
      }
      #endif


      trace.h:------------------------------------------------------------------------

      #define TRACE_1

      enum { TRACE_METHOD_ENTER, TRACE_METHOD_RETURN, TRACE_METHOD_NATIVE_RETURN };


      void trace_method(JNIEnv *env,JVMDI_Event *event, int type);
      void notifyEvent(JNIEnv *env,JVMDI_Event *event);

      #ifdef DEBUG
      void debug(char *);
      #endif

      #endif

      --------------------------------------------------------------------------------
      ---
      (Review ID: 105872)
      ======================================================================

      Name: elR10090 Date: 02/07/2001


      This bug affects the following testbase_nsk test:
          nsk/regression/b4345208

      ======================================================================
      This bug is reproduceable using merlin beta build in weekahead testing

      Steps to reproduce
      1)cd /net/sqesvr.eng/export/vsn/GammaBase/Bugs/{Bugid}/merlin
      2)sh doit

      Output:

      java version "1.4.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b60)
      Java HotSpot(TM) Client VM (build 20010411221312.azeem.merlin_beta-debug, mixed mode)

      # HotSpot Virtual Machine Error, assertion failure
      # Please report this error at
      # http://java.sun.com/cgi-bin/bugreport.cgi
      #
      # assert(_handle != 0, "resolving NULL handle")
      #
      # Error ID: /net/jano.eng/export/disk05/hotspot/imgr/ws/20010411221312.azeem.merlin_beta/src/share/vm/runtime/handles.hpp, 67
      #
      # Problematic Thread: prio=5 tid=0x816e4d8 nid=0x1 runnable
      #
      Dumping core....

      --> b4345208: TESTED_JAVA exit status = 134

      --> Unexpected TESTED_JAVA exit status (#0)!
      ==> nsk/regression/b4345208 TEST FAILED

      satheesh.pothuganti@eng 2001-04-18

            mchung Mandy Chung (Inactive)
            stompkinsunw Sean Tompkins (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: