Re: [Sablevm-developer] Threading support in SableVM
Brought to you by:
egagnon
From: Chris P. <chr...@ma...> - 2004-02-18 06:25:23
|
Etienne Gagnon wrote: > Etienne Gagnon wrote: > >>> It fails in _svmf_enter_object_monitor(). I think Etienne needs to >>> look at it because he wrote the locking stuff ... I would like to >>> participate in debugging it but I don't know where to begin. Should >>> we try, for example, removing thin locks altogether and see if that >>> fixes it? Or try making some critical sections bigger? > > > OK. The bug has been fixed in staging. Thanks a lot, Chris, for > providing me (privately) with a small test case, and reporting the > bug in the first place! :-) No problem :) Thanks for the fix. In case anyone is wondering, it was because in trying to acquire a lock, we initially read a lockword as having no owner. Then, a thinlock was acquired by another thread, and we had to inflate it, but by now the initial lockword value was stale and we were getting a NULL pointer to pass to pthread_mutex_lock() when using the lockword to look up the owner. The solution was simply to retry locking if the owner is NULL. (Etienne pls. correct any mistakes ...) However, I now have another test case (see attached), although I've only seen this bug manifest itself on a multiprocessor. It might affect uniprocessors in more complex scenarios. I get the following about 5% of the time: Exception in thread "Thread-1" java.lang.NullPointerException at IncrementRunnable.run (ThreadStarter.java:29) at java.lang.Thread.run (Thread.java:670) at java.lang.VMThread.callRun (VMThread.java:116) at java.lang.Thread.callRun (Thread.java:343) at java.lang.VirtualMachine.runThread (VirtualMachine.java:117) I have an instruction trace (it took 26 tries to get it!). All that I can see is that the NullPointerException appears to be thrown right after the main() method has exited ... anyway, I'll do some more digging. Cheers, Chris ============ relevant instruction trace ======================= [verbose instructions: executing @0x41353ec4 ALOAD_0] [verbose instructions: executing @0x41353ec8 DUP] [verbose instructions: executing @0x41353ecc GETFIELD_INT] [verbose instructions: executing @0x41353ed8 ICONST_1] [verbose instructions: executing @0x41353edc IADD] [verbose instructions: executing @0x41353ee0 PUTFIELD_INT] [verbose instructions: executing @0x41353eec IINC] [verbose instructions: executing @0x41353ef8 ILOAD_1] [verbose instructions: executing @0x41353efc LDC_INTEGER] [verbose instructions: executing @0x41353f04 IF_ICMPLT_CHECK] [verbose instructions: executing @0x41353f10 RETURN] [verbose methods: exiting method IncrementRunnable.run()V] [ returning to ThreadStarter.main([Ljava/lang/String;)V] [verbose instructions: executing @0x41353844 REPLACE] [verbose instructions: executing @0x41353850 GOTO] [verbose instructions: executing @0x41353734 RETURN] [verbose methods: exiting method ThreadStarter.main([Ljava/lang/String;)V] [ returning to java/lang/VirtualMachine.invokeMain(Ljava/lang/Class;[Ljava/lang/String;)V] [verbose instructions: executing @0x8050eb0 INTERNAL_CALL_END] [verbose methods: exiting method java/lang/VirtualMachine.invokeMain(Ljava/lang/Class;[Ljava/lang/String;)V] [ returning to java/lang/VirtualMachine.main([Ljava/lang/String;)V] [verbose instructions: executing @0x412efff4 REPLACE] [verbose instructions: executing @0x412f0000 GOTO] [verbose instructions: executing @0x412eff50 RETURN] [verbose methods: exiting method java/lang/VirtualMachine.main([Ljava/lang/String;)V] [verbose instructions: executing @0x8050eb0 INTERNAL_CALL_END] [verbose methods: entering method java/lang/NullPointerException.<init>(Ljava/lang/String;)V] [verbose instructions: executing @0x41274204 ALOAD_0] [verbose instructions: executing @0x41274208 ALOAD_1] [verbose instructions: executing @0x4127420c INVOKESPECIAL] [verbose methods: entering method java/lang/RuntimeException.<init>(Ljava/lang/String;)V] [verbose instructions: executing @0x41273df4 ALOAD_0] [verbose instructions: executing @0x41273df8 ALOAD_1] [verbose instructions: executing @0x41273dfc INVOKESPECIAL] [verbose methods: entering method java/lang/Exception.<init>(Ljava/lang/String;)V] [verbose instructions: executing @0x41273e38 ALOAD_0] [verbose instructions: executing @0x41273e3c ALOAD_1] [verbose instructions: executing @0x41273e40 INVOKESPECIAL] [verbose methods: entering method java/lang/Throwable.<init>(Ljava/lang/String;)V] [verbose instructions: executing @0x41273e7c ALOAD_0] [verbose instructions: executing @0x41273e80 INVOKESPECIAL] [verbose methods: entering method java/lang/Object.<init>()V] [verbose instructions: executing @0x41251644 RETURN] [verbose methods: exiting method java/lang/Object.<init>()V] [ returning to java/lang/Throwable.<init>(Ljava/lang/String;)V] [verbose instructions: executing @0x41273e94 ALOAD_0] [verbose instructions: executing @0x41273e98 ALOAD_0] [verbose instructions: executing @0x41273e9c PUTFIELD_REFERENCE] =============================================================== |