RFR(S): 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp

Roland Westrelin roland.westrelin at oracle.com
Thu Jul 10 19:28:24 UTC 2014


http://cr.openjdk.java.net/~roland/8040237/webrev.00/

InstanceKlass::purge_previous_versions() is called on every classes of a class loader from ClassLoaderDataGraph::do_unloading() right before free_deallocate_list() for that class loader. Every reference to a method not on_stack() in the MDO is removed. The following call to free_deallocate_list() frees methods that are not on_stack() for that class loader. Every method that is on_stack() is not freed and references to that method are left as is.
The crash happens because one method’s MDO can reference another method in another class loader. When that happens, the loop in ClassLoaderDataGraph::do_unloading() may call free_deallocate_list() and free redefined method m1 that is not on stack and a subsequent iteration will go over method m2's MDO that references m1 that is gone.

This is fixed by first calling InstanceKlass::purge_previous_versions() on every class of every class loaders in case of class redefinition first and then only iterating again on all class loader data to free metadata.

Coleen recommended the fix to CleanExtraDataMethodClosure::is_live().

I also moved TestSpecTrapClassUnloading.java (test from a previous bug) to the correct subdirectory.

Roland.


More information about the hotspot-compiler-dev mailing list