JDK-4345208 : ArcTest applet with JVM/DI agent crashes VM
  • Type: Bug
  • Component: vm-legacy
  • Sub-Component: jvmdi
  • Affected Version: 1.3.0,1.3.1,1.4.0
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS:
    generic,linux,solaris,solaris_7,solaris_8,windows_nt generic,linux,solaris,solaris_7,solaris_8,windows_nt
  • CPU: generic,x86,sparc
  • Submitted: 2000-06-13
  • Updated: 2007-12-07
  • Resolved: 2001-12-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.4.0 beta3Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Description

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

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: merlin-beta3 FIXED IN: merlin-beta3 INTEGRATED IN: merlin-beta3 VERIFIED IN: merlin-beta3
14-06-2004

EVALUATION ###@###.### 2001-08-23 VM crashes when GetThreadInfo on a thread that has a NULL name. I'll find out what thread is created with NULL name. For sure, we should add NULL check before getting a thread name.
11-06-2004

PUBLIC COMMENTS .
10-06-2004

SUGGESTED FIX ------- jvmdi.cpp ------- 2300c2300,2306 < { const char *n = UNICODE::as_utf8((jchar*) name->base(T_CHAR), name->length()); --- > { const char *n; > > if (name() != NULL) { > n = UNICODE::as_utf8((jchar*) name->base(T_CHAR), name->length()); > } else { > n = UNICODE::as_utf8(NULL, 0); > } ###@###.### 2001-08-23
23-08-2001