Integrated: 8375314: Parallel: Crash iterating over unloaded classes for ObjectCountAfterGC event
Thomas Schatzl
tschatzl at openjdk.org
Thu Jan 22 08:33:07 UTC 2026
On Tue, 20 Jan 2026 13:08:07 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:
> Hi all,
>
> please review this change that avoids crashes when gathering `ObjectCountAfterGC` JFR statisics.
>
> The cause for the crash is that the code purges metaspace after class unloading/purging after https://bugs.openjdk.org/browse/JDK-8361404. The heap iteration code walks the heap with classes that were unloaded and purged, eventually crashing if for some reason the data is invalid due to metaspace purging potentially uncommitting memory.
>
> Since it is somewhat ugly that we walk objects with dead klasses in them (as it was before the mentioned change), I moved the iteration to after the heap has been compacted, skipping filler objects that might be in there.
>
> Unfortunately I did not manage to write a good reproducer.
>
> Testing: gha, tier1-5, test case succeeding
>
> Thanks,
> Thomas
This pull request has now been integrated.
Changeset: f3381f0f
Author: Thomas Schatzl <tschatzl at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/f3381f0ffe2207e1765558f6f49e5a0280a3f920
Stats: 145 lines in 7 files changed: 129 ins; 11 del; 5 mod
8375314: Parallel: Crash iterating over unloaded classes for ObjectCountAfterGC event
Reviewed-by: rkennke, sjohanss, iwalulya
-------------
PR: https://git.openjdk.org/jdk/pull/29318
More information about the hotspot-gc-dev
mailing list