Re: [Sablevm-developer] Uninitialized pthread condition causes a crash
Brought to you by:
egagnon
From: Chris P. <chr...@ma...> - 2004-03-25 19:55:08
|
Hi Julio, I was noticing intermittent problems with thread startup, but IIRC they only actually occurred on multiprocessors. However, improving multiprocessor support in SableVM is important to us (me in particular). I have some other patches in my tree that insert StoreLoad barriers in the right places, as per the JSR-133 Cookbook, but I can't conveniently test your patch against them nor the latest staging + classpath just yet (note to others: including #ifdef'd types in global_alloc.list is a pain), although I'm guessing it will help. Thanks a lot! I spent quite a while looking at this problem before giving up. Note that even for something so small, Etienne will probably need to confirm contribution conditions with you, but I'll let him do that. Cheers, Chris P.S. If anyone has access to NetBSD on a multiprocessor, and I might be able to get some time at some point (not immediately, just sometime) to test threading code of my own (Julio: I'm working on speculative multithreading support), I'd be happy to hear about it. Julio M. Merino Vidal wrote: > 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 > |