JDK-4367553 : Embed JVM in C get "Error ID: 4F533F4C494E55580E4350500549" (perl)
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 1.3.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86
  • Submitted: 2000-08-31
  • Updated: 2012-11-02
  • Resolved: 2001-11-07
Related Reports
Duplicate :  
Description

Name: stC104175			Date: 08/31/2000


[yw@ywlap cgi-bin]$ java -version
java version "1.3.0beta_refresh"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0beta_refresh-b09)
Java HotSpot(TM) Client VM (build 1.3.0beta-b07, mixed mode)
[yw@ywlap cgi-bin]$

I try to embed JVM into Perl, and got this:
[yw@ywlap cgi-bin]$ perl t
Create Jvm!
#
# HotSpot Virtual Machine Error, Internal Error
# Please report this error at
# http://java.sun.com/cgi-bin/bugreport.cgi
#
# Error ID: 4F533F4C494E55580E4350500549
#
# Problematic Thread: Segmentation fault (core dumped)
[yw@ywlap cgi-bin]$

Basically, the perl script invokes C function, which load
$JDKHOME/jre/lib/i386/server/libjvm.so, and use JNI
to invoke Java VM API to access Java.

[yw@ywlap cgi-bin]$ cat t
#!/usr/bin/perl -w
use Jvm;
use Sybase::CTlib;

new Jvm();
[yw@ywlap cgi-bin]$


If take "use Sybase::CTlib" out, it works fine.
It's only has problem when use "Sybase::CTlib" module, which is from
the 3rd party. This module maybe load some other shared lib, and cause
the problem.(It can be downloaded from http://www.mbay.net/~mpeppler)

The "new Jvm()" is very simple, it's implemented in C:

JNIEnv* createJVM () {
    JNIEnv *env;
    JavaVM *jvm;
    /*JDK1_1InitArgs vm_args;*/
	JavaVMInitArgs vm_args;
    jint res;
    jclass cls;
    jmethodID mid;
    jstring jstr;
    jobjectArray args;
    char classpath[1024];

    jint (JNICALL *JNI_DefaultArgs)(void*);
    jint (JNICALL *JNI_CreateVM)(const void*,const void*,void*);
    void * dl_handle;

    /* IMPORTANT: specify vm_args version # if you use JDK1.1.2 and beyond */
 
    /* vm_args.version = 0x00010002; */
    vm_args.version = JNI_VERSION_1_2;
    /* printf("ver %x\n", JNI_VERSION_1_2); */
    vm_args.ignoreUnrecognized = JNI_FALSE;
    /* vm_args.options = options; */
    vm_args.nOptions = 0;

    /*
    JNI_GetDefaultJavaVMInitArgs(&vm_args);
    */

    /* dl_handle = load_so("/home/pkgs/jdk1.3/jre/lib/i386/server/libjvm.so"); *
/
    dl_handle = load_so(g_libjvm);
    JNI_DefaultArgs = (jint (JNICALL *)(void*)) getsym (dl_handle, "JNI_GetDefau
ltJavaVMInitArgs");
    JNI_CreateVM = (jint (JNICALL *)(const void*,const void*,void*)) getsym (dl_
handle, "JNI_CreateJavaVM");
	
    (*JNI_DefaultArgs)(&vm_args);

    /* Create the Java VM */
    /* res = JNI_CreateJavaVM(&jvm,&env,&vm_args); */
    res = (*JNI_CreateVM)(&jvm,&env,&vm_args);
    if (res) {
        fprintf(stderr, "Can't create Java VM\n");
        exit(1);
    }

	return env;
}
(Review ID: 109145) 
======================================================================

Comments
WORK AROUND Name: stC104175 Date: 08/31/2000 Take "use Sybase::CTlib" out, then it works. However it seems the JVM is not stable enough. e.g. even when I take "Sybase::CTlib" out, it still core dump when in perl debug mode: [yw@ywlap cgi-bin]$ cat t #!/usr/bin/perl -w use Jvm; #use Sybase::CTlib; new Jvm(); [yw@ywlap cgi-bin]$ perl t Create Jvm! Attach to jvm, ok! [yw@ywlap cgi-bin]$ [yw@ywlap cgi-bin]$ perl -d t Default die handler restored. Loading DB routines from perl5db.pl version 1.07 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::(t:5): new Jvm(); DB<1> n Create Jvm! # # HotSpot Virtual Machine Error, Internal Error # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Error ID: 4F533F4C494E55580E4350500549 # # Problematic Thread: Signal SEGV: Aborted (core dumped) ====================================================================== ludovic.fernandez@eng 2000-12-18 The JVM fails explicitly when installing a signal handler if there is already a "user" handler installed for this signal. A possible workaround is to launch the JVM with the option "-XX:+AllowUserSignalHandlers" that forces the JVM to continue, ignoring the problematic signal. It is then the responsibility of the "user" handler to call back the JVM in order to properly handle the signal (using the JVM_handle_linux_signal function). I checked that with this option, perl in debug mode doesn't crash the JVM anymore.
11-06-2004

EVALUATION The JVM fails explicitly when installing a signal handler if there is already a "user" handler installed for this signal. Close as a duplicate of 4363638. ###@###.### 2001-11-06
06-11-2001