RFR: 8038468: java/lang/instrument/ParallelTransformerLoader.sh fails with ClassCircularityError

David Holmes david.holmes at oracle.com
Tue Oct 14 02:30:54 UTC 2014


Hi Yumin,

jdk9-dev is not the best place for code review requests. 
serviceability-dev would be better for this test.

On 14/10/2014 8:58 AM, Yumin Qi wrote:
> bug: https://bugs.openjdk.java.net/browse/JDK-8038468
> webrev:*http://cr.openjdk.java.net/~minqi/8038468/webrev00/
>
> the bug marked as confidential so post the webrev internally.

Not any more :)

> Problem: The test case tries to load a class from the same jar via agent
> in the middle of loading another class from the jar via same class
> loader in same thread. The call happens in transform which is a rare
> case --- in middle of loading class, loading another class. The result
> is a CircularityError. When first class is in loading, in vm we put
> JarLoader$2 on place holder table, then we start the defineClass, which
> calls transform, begins loading the second class so go along the same
> routine for loading JarLoader$2 first, found it already in placeholder
> table. A CircularityError is thrown.
> Fix: The test case should not call loading class with same class loader
> in same thread from same jar in 'transform' method. I modify it loading
> with system class loader and we expect see ClassNotFoundException.
> Detail see bug comments.

It is not clear to me that the test is incorrect. It is also unclear why 
such an old test is now failing - we must have changed something.
And it's unclear whether what the test does with your change is actually 
testing what the test wanted to test.

It seems to me that the actual problem in the test is the reference to 
the "main" thread ie:

  if (!tName.equals("main"))

The test knows not to do the loading in the main thread, but has 
overlooked the fact that the main thread, upon the end of main() becomes 
the DestroyJavaVM thread - and it is that thread which encounters the 
ClassCircularityError:

Starting test with 1000 iterations
Thread 'DestroyJavaVM' has called transform()

So perhaps the right fix is to expand the above to:

  if (!tName.equals("main") && !tName.equals("DestroyJavaVM"))

? I admit I'm having trouble seeing the full picture in this test.


Looking at your change, don't leave commented out lines in the code:
  115                         // ClassLoader loader = 
ParallelTransformerLoaderAgent.getClassLoader();
  118                                 //Class.forName("TestClass" + 
index, true, loader);

Thanks,
David

> Thanks
> Yumin *


More information about the jdk9-dev mailing list