RFR (S) 8129355 - [TESTBUG] FragmentMetaspaceSimple.java fails with ClassNotFoundException: test.Empty

Ioi Lam ioi.lam at oracle.com
Thu Jul 2 20:58:48 UTC 2015

Please review a small fix:


Bug: [TESTBUG] runtime FragmentMetaspaceSimple.java fails with 
java.lang.ClassNotFoundException: test.Empty


Cause of failure:

The test case is intended to stress the HotSpot metaspace allocation 
code, for 80 seconds,
     by repeatedly loading many instances of a simple class named 

     In the failing version, each class is loaded by a new 
URLClassLoader instance. So each time
     when a class is loaded, the file system is accessed to read the 
bytes of the class. So
     inadvertently, this test has also become a stress test for the file 

     On some of our embedded test machines, the file system may be 
misbehaving and would fail
     to read the Empty.class file on rare occasions. This causes the 
test failure reported
     by 8129355.

Summary of fix:

     My fix is to not to use URLClassLoader. Instead, read Empty.class 
only once, and store the
     contents into a byte buffer. This buffer will be used to define 
every instance of the Empty

     While this fix does not address the root cause of the failure (file 
system issue in some
     test machines), it will reduce the noise in our nightly tests.

     Also, now that the file system is accessed much less frequently, we 
can run many more iterations
     so we can stress the metaspace more, which is the real intent of 
this test.

     Now it runs for about 80 million iterations on a fast PC and 5 
million iterations on an
     embedded box.


     Since the new version causes more stress in metaspace, I wanted to 
make sure it doesn't cause
     any new failures related to metaspace. So I used the "RBT" tool to 
run the test 50 times
     on 8 platforms:

         linux-arm64, linux-i586, linux-x64, macosx-x64,
         solaris-sparcv9, solaris-x64, windows-i586, windows-x64

     for both product and fast debug builds. I also ran the test on 
32-bit ARM for 12 hours (700+ runs)
     and saw no failure.

- Ioi

More information about the hotspot-runtime-dev mailing list