RFR: 8340631: assert(reserved_rgn->contain_region(base_addr, size)) failed: Reserved CDS region should contain this mapping region [v10]

Ioi Lam iklam at openjdk.org
Wed Jan 8 23:52:49 UTC 2025


On Wed, 8 Jan 2025 22:34:56 GMT, Matias Saavedra Silva <matsaave at openjdk.org> wrote:

>> What testing with `UseCompressedClassPointers` set to false, this assert is hit due to memory being released twice during the failure path of CDS archive mapping. This patch makes it so the RW and RO regions are only released once at the end in `MetaspaceShared::release_reserved_spaces()`. 
>> 
>> This patch hides `unmap_region` as the method should not be called on regions that were reserved. Instead, the region is skipped and we verify that it is indeed in the reserved space. Verified` with tier 1-4 tests.
>
> Matias Saavedra Silva has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Replaced memset

Changes requested by iklam (Reviewer).

src/hotspot/share/cds/filemap.cpp line 2443:

> 2441:         // is released. Zero it so that we don't accidentally read its content.
> 2442:         log_info(cds)("Region #%d (%s) is in a reserved space, it will be freed when the space is released", i, shared_region_name[i]);
> 2443:         r->set_mapped_base(nullptr);

There's no need for this line as it will be set to nullptr below line line 2450.

src/hotspot/share/cds/metaspaceShared.hpp line 2:

> 1: /*
> 2:  * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved.

This is the only change in this file.

-------------

PR Review: https://git.openjdk.org/jdk/pull/22743#pullrequestreview-2538486152
PR Review Comment: https://git.openjdk.org/jdk/pull/22743#discussion_r1907988381
PR Review Comment: https://git.openjdk.org/jdk/pull/22743#discussion_r1907988499


More information about the hotspot-runtime-dev mailing list