JDK-8331675 : gtest CollectorPolicy.young_min_ergo_vm fails after 8272364
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 23
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux,aix
  • CPU: ppc
  • Submitted: 2024-05-03
  • Updated: 2024-06-25
  • Resolved: 2024-06-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 23 JDK 24
23Fixed 24 b02Fixed
Related Reports
Relates :  
Relates :  
Sub Tasks
JDK-8333674 :  
Description
The following failure occurs on platforms with 64k pages (PPC64) since JDK-8272364:
test/hotspot/gtest/gc/shared/test_collectorPolicy.cpp:101: Failure
Expected: (MinNewSize) <= (param), actual: 22347776 vs 20971520

test/hotspot/gtest/gc/shared/test_collectorPolicy.cpp:80: Failure
Expected: checker->execute() doesn't generate new fatal failures in the current thread.
  Actual: it does.

[  FAILED  ] CollectorPolicy.young_min_ergo_vm (0 ms)

Comments
A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/19759 Date: 2024-06-18 07:23:08 +0000
18-06-2024

Thank you for removing it!
11-06-2024

Changeset: badf1cb9 Author: Albert Mingkun Yang <ayang@openjdk.org> Date: 2024-06-11 06:57:05 +0000 URL: https://git.openjdk.org/jdk/commit/badf1cb9ce9dcae6cca92046f7cc1231067ca799
11-06-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/19621 Date: 2024-06-10 09:53:02 +0000
10-06-2024

Thanks for the confirmation. Then, the same assert (min-new-size <= new-size) is already done inside VM, so the usefulness of this test is close to zero. What do others think of removing it?
07-06-2024

Yes, ASSERT_LE(MinNewSize, NewSize); fixes the issue.
06-06-2024

`CheckYoungMin` should probably check against `NewSize` directly, instead of the arbitrary value from its constructor. More like `CheckScaledYoungInitial`, for instance. [~mdoerr] Can you check if using `ASSERT_LE(MinNewSize, NewSize);` in `CheckYoungMin` fixes the issue? As for the failure observed in young_scaled_initial_ergo_vm, it's completely expected, because that test assumes NewSize is set ergo not cmdline. The `TEST_VM_OPTS` interferes with the test's assumption. (gtest probably should not run with additional vm flags.)
06-06-2024

[~mdoerr] Ah, this is definitely inconsistent between the test and code. Test says: (https://github.com/openjdk/jdk/blob/master/test/hotspot/gtest/gc/shared/test_collectorPolicy.cpp#L224) // If NewSize has been ergonomically set, the collector policy // should use it for min but calculate the initial young size // using NewRatio. and code says: (https://github.com/openjdk/jdk/blob/master/src/hotspot/share/gc/shared/genArguments.cpp#L258) // If NewSize is set on the command line, we should use it as // the initial size, but make sure it is within the heap bounds. I will file a bug.
31-05-2024

[~zgu] Thank you for looking into it! Using TEST_VM_OPTS="-Xlog:gc+heap=trace -XX:NewSize=20m" seems to fix CollectorPolicy.young_min_ergo_vm, but moves the error to CollectorPolicy.young_scaled_initial_ergo_vm: [ RUN ] CollectorPolicy.young_min_ergo_vm [0.001s][trace][gc,heap] Maximum heap size 2112225280 [0.001s][trace][gc,heap] Initial heap size 132014080 [0.001s][trace][gc,heap] Minimum heap size 26424112 [0.007s][debug][gc,heap] Minimum heap 33554432 Initial heap 134217728 Maximum heap 2113929216 [0.245s][debug][gc,heap] Minimum heap 67108864 Initial heap 134217728 Maximum heap 2113929216 [0.245s][trace][gc,heap] 1: Minimum young 20971520 Initial young 20971520 Maximum young 83886080 [0.245s][trace][gc,heap] Minimum old 46137344 Initial old 113246208 Maximum old 2030043136 [ OK ] CollectorPolicy.young_min_ergo_vm (0 ms) [ RUN ] CollectorPolicy.young_scaled_initial_ergo_vm [0.245s][debug][gc,heap] Minimum heap 67108864 Initial heap 134217728 Maximum heap 2113929216 [0.245s][trace][gc,heap] 1: Minimum young 20971520 Initial young 20971520 Maximum young 83886080 [0.245s][trace][gc,heap] Minimum old 46137344 Initial old 113246208 Maximum old 2030043136 /sapmnt/sapjvm_work/d056149/jdk/test/hotspot/gtest/gc/shared/test_collectorPolicy.cpp:124: Failure Expected equality of these values: expected Which is: 44695552 NewSize Which is: 20971520 jdk/test/hotspot/gtest/gc/shared/test_collectorPolicy.cpp:80: Failure Expected: checker->execute() doesn't generate new fatal failures in the current thread. Actual: it does. [ FAILED ] CollectorPolicy.young_scaled_initial_ergo_vm (0 ms) Do you have a suggestion how to fix the test?
31-05-2024

Okay, I believe this failure is a test bug. The test launches JVM without NewSize parameter, therefore, JVM ergonomics kicks in and derives MinNewSize from Minimum heap size, which results execution of new code introduced in JDK-8272364. Then the test tries to set NewSize after MinNewSize already computed, which has no effect on MinNewSize. When test checks MinNewSize (instead of NewSize), test fails, because MinNewSize is derived from Minimum heap 67108864. If you launch JVM with NewSize=20m, MinNewSize should be 20m, e.g. run the test with "TEST_VM_OPTS="-Xlog:gc+heap=trace -XX:NewSize=20m"
31-05-2024

TEST_VM_OPTS="-Xlog:gc+heap=trace" output: [ RUN ] CollectorPolicy.young_min_ergo_vm [0.017s][trace][gc,heap] Maximum heap size 2112225280 [0.017s][trace][gc,heap] Initial heap size 132014080 [0.017s][trace][gc,heap] Minimum heap size 6815736 [0.052s][debug][gc,heap] Minimum heap 33554432 Initial heap 134217728 Maximum heap 2113929216 [0.339s][debug][gc,heap] Minimum heap 67108864 Initial heap 134217728 Maximum heap 2113929216 [0.339s][trace][gc,heap] 1: Minimum young 22347776 Initial young 44695552 Maximum young 83886080 [0.339s][trace][gc,heap] Minimum old 44761088 Initial old 89522176 Maximum old 2030043136 test/hotspot/gtest/gc/shared/test_collectorPolicy.cpp:101: Failure Expected: (MinNewSize) <= (param), actual: 22347776 vs 20971520
24-05-2024

There are some weirdnesses of gtest, some ergonomics values just do not match standalone java's. e.g. https://github.com/openjdk/jdk/pull/18539#discussion_r1579492865
21-05-2024

We could avoid the src - change from https://github.com/openjdk/jdk/commit/6bef0474c8b8773d0d20c0f25c36a2ce9cdbd7e8 MinNewSize = MIN2(scale_by_NewRatio_aligned(MinHeapSize, GenAlignment), initial_young_size); on ppc64(le) platforms; from the gtest it seems MinNewSize got too large after this change. Or is the gtest wrong in some way ?
21-05-2024

This is odd, because CollectorPolicy.young_min_ergo_vm seems to test when NewSize is explicitly set, while JDK-8272364 change only applies to the code path that NewSize is *not* explicitly set.
09-05-2024