RFR 8208697: vmTestbase/metaspace/stressHierarchy/stressHierarchy012/TestDescription.java fails with OutOfMemoryError: Metaspace

coleen.phillimore at oracle.com coleen.phillimore at oracle.com
Mon Sep 10 15:48:05 UTC 2018



On 9/10/18 11:38 AM, Lois Foltan wrote:
> On 9/7/2018 6:07 PM, coleen.phillimore at oracle.com wrote:
>> Summary: remove timeoutHandler class and let Stresser handle timeout, 
>> remove 30 threads filling metaspace, and remove related unused files.
>>
>> This also fixes a compilation warning in GeneratingClassLoader.java 
>> (unreachable try block).
>>
>> open webrev at http://cr.openjdk.java.net/~coleenp/8208697.01/webrev
>> bug link https://bugs.openjdk.java.net/browse/JDK-8208697
>>
>> Tested 300+ times without failure.  Usual rate is 2-100.
>>
>> Thanks,
>> Coleen
>>
> Hi Coleen,
>
> Looks good.  One minor comment:
>
> nsk/share/classload/GeneratingClassLoader.java:
> line #123 - should there be some sort of throw if an exception is 
> thrown that is not a UnsupportedEncodingException?  Otherwise the 
> byte[] array returned would be garbage?

For both UnsupportedEncodingException and any unhandled exception, I 
think the byte array shouldn't be used/trusted because both will throw 
or propagate the exception.  There's no return.


         private byte[] getPatchedByteCode(String name) throws 
ClassNotFoundException {
                 try {
                         byte[] bytecode = getByteCode();
                         String fname = name.replace(".", File.separator);
                         byte[] replaceBytes = fname.getBytes(encoding);
                         for (int offset : offsets) {
                                 for (int i = 0; i < 
replaceBytes.length; ++i)
                                         bytecode[offset + i] = 
replaceBytes[i];
                         }
                         return bytecode;
                 } catch (UnsupportedEncodingException e) {
                         throw new TestBug(e);
                 }
         }

Thanks for reviewing the change!
Coleen

>
> Thanks,
> Lois



More information about the hotspot-runtime-dev mailing list