harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrey Pavlenko (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-5505) [drlvm][JNI] Unable to create, destroy, create VM in the same process.
Date Wed, 13 Feb 2008 14:41:08 GMT
[drlvm][JNI] Unable to create, destroy, create VM in the same process.
----------------------------------------------------------------------

                 Key: HARMONY-5505
                 URL: https://issues.apache.org/jira/browse/HARMONY-5505
             Project: Harmony
          Issue Type: Bug
          Components: DRLVM
         Environment: SLES10
            Reporter: Andrey Pavlenko


The function JNI_CreateJavaVM() causes Segmentation fault if it is called after the VM has
been destroyed in the same process. The following test reproduces this issue:

#include "jni.h"

static JavaVM * p_vm;
static JNIEnv * p_env;

static void vm_create() {
	JavaVMInitArgs vm_args;
	JavaVMOption options[0];

	JNI_GetDefaultJavaVMInitArgs(&vm_args);
	vm_args.options = options;
	vm_args.nOptions = 0;
	vm_args.ignoreUnrecognized = JNI_TRUE;
	vm_args.version = JNI_VERSION_1_2;

	if (JNI_CreateJavaVM(&p_vm, &p_env, &vm_args) < 0) {
		printf("Failed to create VM\n");
	}
	printf("VM created\n");
}

static void vm_destroy() {
	if (p_vm == NULL) {
		printf("VM not created\n");
		return;
	}

	if ((*p_vm)->DestroyJavaVM(p_vm) < 0) {
		printf("Failed to destroy VM\n");
	}

	p_vm = NULL;
	p_env = NULL;
	printf("VM destroyed\n");
}

int main() {
	vm_create();
	vm_destroy();
	vm_create();
	return 0;
}


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message