[Sablevm-developer] Uninitialized pthread condition causes a crash
Brought to you by:
egagnon
From: Julio M. M. V. <jm...@me...> - 2004-03-25 18:51:37
|
Hi all, I have just built and installed sablevm under NetBSD. The build goes fine, (aside two minor problems I'll describe in another mail when I find the right solution), but when running threaded applications, it crashes. The native libpthread library in NetBSD is full of assertions to capture problems like uses of uninitialized mutexes or conditions. And this is what's happening. The vm->threads.vm_destruction_cond condition is never initialized, so when a wait happens, the vm crashes. I've patched the code to initialize the condition in the invoke_interface.c file, JNI_CreateJavaVM function. I'm not sure if this is right (but is where I found other initializations). AFAICT, it's working now (no crash, and a consumer/producer test program works fine). The patch is this: --- src/libsablevm/invoke_interface.c.orig 2004-03-20 23:02:04.000000000 +0100 +++ src/libsablevm/invoke_interface.c @@ -220,6 +220,7 @@ JNI_CreateJavaVM (JavaVM **pvm, void **p } _svmf_set_current_env (env); + _svmm_cond_init (vm->threads.vm_destruction_cond); vm->threads.user = env; vm->threads.next_thread_id = 1; /* thread IDs must start at 1 (i.e. no ID == 0) */ Kind regards -- Julio M. Merino Vidal <jm...@me...> The NetBSD Project - http://www.NetBSD.org/ |