Integrated: 8297427: Avoid keeping class loaders alive when executing ClassLoaderStatsVMOperation
Stefan Johansson
sjohanss at openjdk.org
Thu Dec 1 10:33:38 UTC 2022
On Tue, 22 Nov 2022 20:54:54 GMT, Stefan Johansson <sjohanss at openjdk.org> wrote:
> Please review this change to avoid keeping classes alive only due to the `ClassLoaderStatsVMOperation`.
>
> **Summary**
> The `ClassLoaderStatsVMOperation` is gathering statistics about the active class loaders in a safepoint. The way the `ClassLoaderDataGraph` is iterated will keep the class loaders live. This is not really needed since everything is done in a safepoint and nothing needs to be explicitly kept alive. This has not been a problem prior to concurrent class unloading in ZGC. With fully concurrent class unloading a `ClassLoaderStatsVMOperation` can occur during a collection and more classes than needed might be kept alive. This could in turn lead to premature Metaspace OOM.
>
> The solution is to not keep the class loaders alive due to the iteration in `ClassLoaderStatsVMOperation`.
>
> **Testing**
> * Added a new test that covers the two different ways a class could previously be kept alive by the VM operation. The test passes after the fix but failed before.
> * Mach5 tier 1-3
This pull request has now been integrated.
Changeset: eea1a8a9
Author: Stefan Johansson <sjohanss at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/eea1a8a95e172ef5221ab622d171f46cc6cbb598
Stats: 242 lines in 10 files changed: 237 ins; 0 del; 5 mod
8297427: Avoid keeping class loaders alive when executing ClassLoaderStatsVMOperation
Reviewed-by: eosterlund, stefank
-------------
PR: https://git.openjdk.org/jdk/pull/11300
More information about the hotspot-dev
mailing list