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

8254309: appcds GCDuringDump.java failed - class must exist #948

Closed
wants to merge 4 commits into from

Conversation

@yminqi
Copy link
Contributor

@yminqi yminqi commented Oct 30, 2020

Hi, Please review
When CDS at dump time initializes archived heap, some classes are loaded. If at this time system runs out of memory the class will not be loaded. This is what we saw in this bug. The fix checks if OOM happened, if so we print out log and exit gracefully not causing a crash. Added a test case for testing purpose when exception/OOM happens during this stage. Also check during preload classes when OOM happens, exit vm with proper message.

Tests: tier1-4

Thanks
Yumin


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8254309: appcds GCDuringDump.java failed - class must exist

Reviewers

Download

$ git fetch https://git.openjdk.java.net/jdk pull/948/head:pull/948
$ git checkout pull/948

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Oct 30, 2020

👋 Welcome back minqi! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

Loading

@openjdk openjdk bot added the rfr label Oct 30, 2020
@openjdk
Copy link

@openjdk openjdk bot commented Oct 30, 2020

@yminqi The following label will be automatically applied to this pull request:

  • hotspot

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

Loading

@openjdk openjdk bot added the hotspot label Oct 30, 2020
@mlbridge
Copy link

@mlbridge mlbridge bot commented Oct 30, 2020

Loading

if (exception->is_a(SystemDictionary::OutOfMemoryError_klass())) {
vm_exit_during_cds_dumping("Out of memory. Please run with a bigger Java heap");
}
Copy link
Member

@calvinccheung calvinccheung Oct 30, 2020

Choose a reason for hiding this comment

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

I'd suggesting replacing 'bigger' with 'larger'.

I think it would be more informative if the message includes the MaxHeapSize setting.

Loading

Copy link
Contributor Author

@yminqi yminqi Oct 30, 2020

Choose a reason for hiding this comment

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

fixed with detail message.

Loading

Object[] a = new Object[10000];
Object[] a = new Object[40000];
Copy link
Member

@calvinccheung calvinccheung Oct 30, 2020

Choose a reason for hiding this comment

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

Any reason for increasing the size by 4 times?

Loading

Copy link
Contributor Author

@yminqi yminqi Oct 30, 2020

Choose a reason for hiding this comment

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

changed back to original value.

Loading

Copy link
Member

@calvinccheung calvinccheung left a comment

Looks good.

Loading

void ArchiveUtils::check_for_oom(oop exception) {
assert(exception != nullptr, "Sanity check");
if (exception->is_a(SystemDictionary::OutOfMemoryError_klass())) {
vm_exit_during_cds_dumping(err_msg("Out of memory. Please run with a larger Java heap, current MaxHeapSize = " SIZE_FORMAT "M", MaxHeapSize/M));
Copy link
Member

@calvinccheung calvinccheung Oct 30, 2020

Choose a reason for hiding this comment

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

Line is too long. Consider break this into 2 to 3 lines.

Loading

Copy link
Member

@calvinccheung calvinccheung left a comment

Just one nit.

Loading

@openjdk
Copy link

@openjdk openjdk bot commented Oct 30, 2020

@yminqi This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8254309: appcds GCDuringDump.java failed - class must exist

Reviewed-by: ccheung, iklam

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 18 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

Loading

@openjdk openjdk bot added the ready label Oct 30, 2020
_dump_time_subgraph_info_table = new (ResourceObj::C_HEAP, mtClass)DumpTimeKlassSubGraphInfoTable();

if (_dump_time_subgraph_info_table == nullptr) {
Copy link
Member

@iklam iklam Oct 30, 2020

Choose a reason for hiding this comment

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

There's no need to check for failure for new (ResourceObj::C_HEAP, mtClass), because it calls this operator:

void* ResourceObj::operator new(size_t size, allocation_type type, MEMFLAGS flags) throw() {
  address res = NULL;
  switch (type) {
   case C_HEAP:
    res = (address)AllocateHeap(size, flags, CALLER_PC);
    ....

which calls

char* AllocateHeap(size_t size,
                   MEMFLAGS flags,
                   const NativeCallStack& stack,
                   AllocFailType alloc_failmode /* = AllocFailStrategy::EXIT_OOM*/) {
  char* p = (char*) os::malloc(size, flags, stack);
  if (p == NULL && alloc_failmode == AllocFailStrategy::EXIT_OOM) {
    vm_exit_out_of_memory(size, OOM_MALLOC_ERROR, "AllocateHeap");
  }

which will exit the VM automatically when we run out of C heap.

Loading

iklam
iklam approved these changes Oct 30, 2020
Copy link
Member

@calvinccheung calvinccheung left a comment

Looks good.

Loading

@yminqi
Copy link
Contributor Author

@yminqi yminqi commented Oct 31, 2020

/integrate

Loading

@openjdk openjdk bot closed this Oct 31, 2020
@openjdk openjdk bot added integrated and removed ready rfr labels Oct 31, 2020
@openjdk
Copy link

@openjdk openjdk bot commented Oct 31, 2020

@yminqi Since your change was applied there have been 18 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

Pushed as commit 9d5c9cc.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Loading

@yminqi yminqi deleted the jdk-8254309 branch Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants