8013945: CMS fatal error: must own lock MemberNameTable_lock
authorsspitsyn
Fri, 24 May 2013 17:36:12 -0700
changeset 17830 6bb6155c908a
parent 17829 b3418ee51a7c
child 17831 d8112d90739f
8013945: CMS fatal error: must own lock MemberNameTable_lock Summary: The "delete mnt" needs to grab MemberNameTable_lock if !SafepointSynchronize::is_at_safepoint() Reviewed-by: sla, mgerdin, dholmes, jmasa Contributed-by: serguei.spitsyn@oracle.com
hotspot/src/share/vm/oops/instanceKlass.cpp
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp	Fri May 24 10:21:12 2013 -0700
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp	Fri May 24 17:36:12 2013 -0700
@@ -2320,10 +2320,15 @@
     FreeHeap(jmeths);
   }
 
-  MemberNameTable* mnt = member_names();
-  if (mnt != NULL) {
-    delete mnt;
-    set_member_names(NULL);
+  // Deallocate MemberNameTable
+  {
+    Mutex* lock_or_null = SafepointSynchronize::is_at_safepoint() ? NULL : MemberNameTable_lock;
+    MutexLockerEx ml(lock_or_null, Mutex::_no_safepoint_check_flag);
+    MemberNameTable* mnt = member_names();
+    if (mnt != NULL) {
+      delete mnt;
+      set_member_names(NULL);
+    }
   }
 
   int* indices = methods_cached_itable_indices_acquire();