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

8315127: CDSMapTest fails with incorrect number of oop references #15527

Closed

Conversation

iklam
Copy link
Member

@iklam iklam commented Sep 1, 2023

This is a bug in the test case. The test parses patterns like this in the map file

0x00000000ffe00000: @@ Object (0xffe00000) java.lang.String
 - klass: 'java/lang/String' 0x0000000800010220
 - fields (3 words):
 - private 'hash' 'I' @12  0 (0x00000000)
 - private final 'coder' 'B' @16  0 (0x00)
 - private 'hashIsZero' 'Z' @17  true (0x01)
 - injected 'flags' 'B' @18  1 (0x01)
 - private final 'value' '[B' @20 0x00000000ffe00018 (0xffe00018) [B length: 0
0x00000000ffe00018: @@ Object (0xffe00018) [B length: 0
 - klass: {type array byte} 0x00000008000024d8

Before this fix, the test assets that there are at least 10000 oop references (such as the value field in the above String). However, some JDK builds may have fewer archived heap objects, resulting in less than 10000 references (the graal build in the bug report has only 8286 references).

After this fix, we check that the number of oop references is not fewer than the number of strings, as we know each string contains one oop field. This is sufficient to check that the map file contains expected output, without using a hard-coded number.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8315127: CDSMapTest fails with incorrect number of oop references (Bug - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/15527/head:pull/15527
$ git checkout pull/15527

Update a local copy of the PR:
$ git checkout pull/15527
$ git pull https://git.openjdk.org/jdk.git pull/15527/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 15527

View PR using the GUI difftool:
$ git pr show -t 15527

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/15527.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 1, 2023

👋 Welcome back iklam! 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.

@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 1, 2023
@openjdk
Copy link

openjdk bot commented Sep 1, 2023

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

  • hotspot-runtime

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.

@openjdk openjdk bot added the hotspot-runtime hotspot-runtime-dev@openjdk.org label Sep 1, 2023
@mlbridge
Copy link

mlbridge bot commented Sep 1, 2023

Webrevs

Copy link
Member

@calvinccheung calvinccheung left a comment

Choose a reason for hiding this comment

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

I have one question and spotted two minor issues.

@@ -282,16 +309,29 @@ public static int validate(MapFile mapFile) {
// To see how an invalidate pointer may be found, change oop in the
// following line to oop+1
mustContain(mapFile.oopToObject, field, oop, false);
count ++;
count1 ++;
Copy link
Member

Choose a reason for hiding this comment

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

Could oop be 0? If so, oop could be overcounted.

Pre-existing: extra import at line 27
import java.io.RandomAccessFile;

Copy link
Member Author

Choose a reason for hiding this comment

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

I added checks for oop != 0, so now the test is counting only the non-null references.

throw new RuntimeException("CDS map file seems incorrect: " + mapFile.heapObjectCount() +
" objects but only " + oopFieldCount + " oop field references");
}
CDSMapReader.validate(mapFile);
Copy link
Member

Choose a reason for hiding this comment

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

Pre-existing: extra import at lines 36 and 37

import java.io.FileInputStream;
import java.io.IOException;

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

@@ -254,7 +279,8 @@ public static MapFile read(String fileName) {
throw new RuntimeException(t);
} finally {
System.out.println("Parsed " + lineCount + " lines in " + fileName);
System.out.println("Found " + mapFile.heapObjectCount() + " heap objects");
System.out.println("Found " + mapFile.heapObjectCount() + " heap objects ("
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
System.out.println("Found " + mapFile.heapObjectCount() + " heap objects ("
System.out.println("Found " + mapFile.heapObjectCount() + " heap objects ("

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

Copy link
Member

@calvinccheung calvinccheung left a comment

Choose a reason for hiding this comment

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

Thanks for the update. It looks good.

@openjdk
Copy link

openjdk bot commented Sep 2, 2023

@iklam 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:

8315127: CDSMapTest fails with incorrect number of oop references

Reviewed-by: ccheung

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 22 new commits pushed to the master branch:

  • 4f90aba: 8311585: Add JRadioButtonMenuItem to bug8031573.java
  • 2a11bc4: 8314837: 5 compiled/codecache tests ignore VM flags
  • 2f7c65e: 8303427: Fixpath confused if unix root contains "/jdk"
  • e9e0c56: 8314319: LogCompilation doesn't reset lateInlining when it encounters a failure.
  • 56b8db1: 8258970: Disabled JPasswordField foreground color is wrong with GTK LAF
  • 0d4cadb: 8315195: RISC-V: Update hwprobe query for new extensions
  • b4f7069: 8315446: G1: Remove unused G1AllocRegion::attempt_allocation
  • cf02cf3: 8315098: Improve URLEncodeDecode microbenchmark
  • c32e340: 8315321: [aix] os::attempt_reserve_memory_at must map at the requested address or fail
  • 42f5b9e: 8315436: HttpsServer does not send TLS alerts
  • ... and 12 more: https://git.openjdk.org/jdk/compare/c8acab1d913a6c676706fce7ad98a7f831a95682...master

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.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 2, 2023
@iklam
Copy link
Member Author

iklam commented Sep 5, 2023

Thanks @calvinccheung and @turbanoff for the review and comments.
/integrate

@openjdk
Copy link

openjdk bot commented Sep 5, 2023

Going to push as commit 1f4cdb3.
Since your change was applied there have been 49 commits pushed to the master branch:

  • 939d7c5: 8161536: sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java fails with ProviderException
  • ebe3127: 8315717: ProblemList serviceability/sa/TestHeapDumpForInvokeDynamic.java with ZGC
  • 969fcdb: 8314191: C2 compilation fails with "bad AD file"
  • cef9fff: 8305507: Add support for grace period before AbortVMOnSafepointTimeout triggers
  • ed2b467: 8315499: build using devkit on Linux ppc64le RHEL puts path to devkit into libsplashscreen
  • 4b44575: 8305637: Remove Opaque1 nodes for Parse Predicates and clean up useless predicate elimination
  • 8647f00: 8293850: need a largest_committed metric for each category of NMT's output
  • 5a2e151: 8315548: G1: Document why VM_G1CollectForAllocation::doit() may allocate without completing a GC
  • 9013b03: 8315442: Enable parallelism in vmTestbase/nsk/monitoring/stress/thread tests
  • 744b397: 8312491: Update Classfile API snippets and examples
  • ... and 39 more: https://git.openjdk.org/jdk/compare/c8acab1d913a6c676706fce7ad98a7f831a95682...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Sep 5, 2023
@openjdk openjdk bot closed this Sep 5, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Sep 5, 2023
@openjdk
Copy link

openjdk bot commented Sep 5, 2023

@iklam Pushed as commit 1f4cdb3.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-runtime hotspot-runtime-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

3 participants