RFR (XS): 8211123: GC Metaspace printing after full gc does not reflect recent changes (Was: Re: A Bug Of Metaspace After Full GC)

Thomas Stüfe thomas.stuefe at gmail.com
Thu Sep 27 14:17:05 UTC 2018


On Thu, Sep 27, 2018 at 2:09 PM, Thomas Schatzl
<thomas.schatzl at oracle.com> wrote:
> Hi JC,
> On Wed, 2018-09-26 at 19:21 -0700, JC Beyler wrote:
>> Hi Thomas et al,
>> Thanks for moving this thread to a RFR. Here is the webrev and bug:
>> Webrev: http://cr.openjdk.java.net/~jcbeyler/8211123/webrev.00/
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8211123
>> For the test, I inspired myself of a few different tests to get this
>> up and running. I didn't find a means to use only the WhiteBox to get
>> the metaspace filled. I did not want to use the .jar that the
>> original reproducer was using since it was using a library. So I used
>> the testcases.jar from the runtime/7116786 test.
>> I also use a separate process to test the various GCs and ensure it
>> works for all.
>> Btw, I've put nijiaben as the contributor for the webrev.
>> Let me know what you think, I imagine I've made the test a bit more
>> complicated than need be,
>> Jc
> I do not know a better way than having an external jar to do class
> loading into a separate class loader in a test. It's safest to
> duplicate the jar file.

Just as a suggestion, I did tests - but never really got to jtreg-ify
them - for JDK-8198423.

They use javax.tools.JavaCompiler to compile classes on the fly and
load them into separate class loaders.

See e.g. https://github.com/tstuefe/ojdk-repros/blob/master/src/test3/Example2.java

(Not the prettiest program ever, but enough to demonstrate the point).

Best, Thomas

> The test could be simplified a bit by using the Metaspace MemoryMXBean
> to get metaspace memory readings (there is an MXBean called
> "Metaspace"), removing the need for invoking a secondary JVM in the
> test and parsing the log :)
> You can then run the test with the different collectors using
> "main/othervm -XX:+<some-gc> MyTest" lines.
> Otherwise the change itself looks good. I would appreciate if the test
> could be improved as mentioned above, but if you do not want to I could
> live with it as is.
> Btw, you can have multiple contributors in that line (or probably
> multiple Contributed-by lines).
> Thanks,
>   Thomas

More information about the hotspot-gc-dev mailing list