Skip to content
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

8261551: Remove special CDS handling in Metaspace::allocate #3185

Closed
Closed
Changes from all commits
Commits
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

@@ -822,13 +822,6 @@ MetaWord* Metaspace::allocate(ClassLoaderData* loader_data, size_t word_size,
}

if (result == NULL) {
if (DumpSharedSpaces) {
// CDS dumping keeps loading classes, so if we hit an OOM we probably will keep hitting OOM.
// We should abort to avoid generating a potentially bad archive.
vm_exit_during_cds_dumping(err_msg("Failed allocating metaspace object type %s of size " SIZE_FORMAT ". CDS dump aborted.",
MetaspaceObj::type_name(type), word_size * BytesPerWord),
err_msg("Please increase MaxMetaspaceSize (currently " SIZE_FORMAT " bytes).", MaxMetaspaceSize));
}
report_metadata_oome(loader_data, word_size, type, mdtype, THREAD);
assert(HAS_PENDING_EXCEPTION, "sanity");
return NULL;
@@ -612,7 +612,8 @@ void MetaspaceShared::prepare_for_dumping() {

// Preload classes from a list, populate the shared spaces and dump to a
// file.
void MetaspaceShared::preload_and_dump(TRAPS) {
void MetaspaceShared::preload_and_dump() {

This comment has been minimized.

@dholmes-ora

dholmes-ora Mar 26, 2021
Member

I would have kept the Thread argument to avoid the implicit Thread::current() in EXCEPTION_MARK. But it is a margin call either way.

EXCEPTION_MARK;
ResourceMark rm(THREAD);
preload_and_dump_impl(THREAD);
if (HAS_PENDING_EXCEPTION) {
@@ -77,7 +77,7 @@ class MetaspaceShared : AllStatic {
};

static void prepare_for_dumping() NOT_CDS_RETURN;
static void preload_and_dump(TRAPS) NOT_CDS_RETURN;
static void preload_and_dump() NOT_CDS_RETURN;

private:
static void preload_and_dump_impl(TRAPS) NOT_CDS_RETURN;
@@ -3401,7 +3401,7 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
#endif

if (DumpSharedSpaces) {
MetaspaceShared::preload_and_dump(CHECK_JNI_ERR);
MetaspaceShared::preload_and_dump();
ShouldNotReachHere();
}

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@ public static void main(String[] args) throws Exception {
processArgs.add("-XX:MaxMetaspaceSize=1m");
}

String msg = "Failed allocating metaspace object";
String msg = "OutOfMemoryError: Metaspace";
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(processArgs);
CDSTestUtils.executeAndLog(pb, "dump").shouldContain(msg).shouldHaveExitValue(1);
}
ProTip! Use n and p to navigate between commits in a pull request.