Skip to content

8360048: NMT crash in gtest/NMTGtests.java: fatal error: NMT corruption: Block at 0x0000017748307120: header canary broken #25950

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 25 additions & 8 deletions test/hotspot/gtest/runtime/test_virtualMemoryTracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ static void check_inner(const ReservedMemoryRegion& rmr, R* regions, size_t regi
class VirtualMemoryTrackerTest {
public:
static void test_add_committed_region_adjacent() {
RegionsTree* rtree;
{
MemTracker::NmtVirtualMemoryLocker nvml;
rtree = VirtualMemoryTracker::Instance::tree();
rtree->tree().remove_all();
}

size_t size = 0x01000000;
ReservedSpace rs = MemoryReserver::reserve(size, mtTest);
Expand All @@ -105,7 +111,6 @@ class VirtualMemoryTrackerTest {

// Fetch the added RMR for the space
ReservedMemoryRegion rmr = VirtualMemoryTracker::Instance::tree()->find_reserved_region(addr);
RegionsTree* rtree = VirtualMemoryTracker::Instance::tree();

ASSERT_EQ(rmr.size(), size);
ASSERT_EQ(rmr.base(), addr);
Expand Down Expand Up @@ -167,13 +172,18 @@ class VirtualMemoryTrackerTest {
}

static void test_add_committed_region_adjacent_overlapping() {
RegionsTree* rtree = VirtualMemoryTracker::Instance::tree();
rtree->tree().remove_all();
RegionsTree* rtree;
{
MemTracker::NmtVirtualMemoryLocker nvml;
rtree = VirtualMemoryTracker::Instance::tree();
rtree->tree().remove_all();
}

size_t size = 0x01000000;
ReservedSpace rs = MemoryReserver::reserve(size, mtTest);
MemTracker::NmtVirtualMemoryLocker nvml;


address addr = (address)rs.base();

address frame1 = (address)0x1234;
Expand Down Expand Up @@ -255,11 +265,14 @@ class VirtualMemoryTrackerTest {
}

static void test_add_committed_region_overlapping() {
RegionsTree* rtree = VirtualMemoryTracker::Instance::tree();
rtree->tree().remove_all();
RegionsTree* rtree;
{
MemTracker::NmtVirtualMemoryLocker nvml;
rtree = VirtualMemoryTracker::Instance::tree();
rtree->tree().remove_all();
}

size_t size = 0x01000000;

ReservedSpace rs = MemoryReserver::reserve(size, mtTest);
MemTracker::NmtVirtualMemoryLocker nvml;

Expand Down Expand Up @@ -432,8 +445,12 @@ class VirtualMemoryTrackerTest {
}

static void test_remove_uncommitted_region() {
RegionsTree* rtree = VirtualMemoryTracker::Instance::tree();
rtree->tree().remove_all();
RegionsTree* rtree;
{
MemTracker::NmtVirtualMemoryLocker nvml;
rtree = VirtualMemoryTracker::Instance::tree();
rtree->tree().remove_all();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I asked about this before - can we do remove_all in the constructor to avoid this 2 line repeating pattern?

Otherwise looks good, can you please check the GHA test failures on Windows?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that's the right way to go. I think it's better if we can avoid using the global instance, and not change the code of the VMT in order to appease the tests.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I suggested the easiest fix I could think of, but doing it this way is even better!

}

size_t size = 0x01000000;
ReservedSpace rs = MemoryReserver::reserve(size, mtTest);
Expand Down