RFR: 8376106: TestObjectDescription.java intermittent fails Unable to replace class name [v2]
Robert Toyonaga
duke at openjdk.org
Fri Feb 27 16:27:40 UTC 2026
> This change prevents the counter from overflowing.
>
> ### Problem:
> The counter overflows at 2002 iterations because on each iteration the retry loop calls `testClassLoader.loadClasses(OldObjects.MIN_SIZE / 20)`.
> `OldObjects.MIN_SIZE` = 99901 , so 99901 / 20 = 4995 classes are loaded each iteration.
>
> The constructed `className` must be exactly the same length as "TestClass0000000". Which means the max number of classes loaded can be 9,999,999. After 2002 iterations we hit the limit (2002 * 4995 = 9,999,990).
>
> ### Solution
>
> Making `classIdCounter` non-`static` forces the counter to reset with each iteration of `TestObjectDescription.asseertObjectDescription`. The maximum value of the counter is now 4995, so it cannot possibly overflow no matter how long it takes to collect the leak samples.
>
> Testing:
> - Re-running the test 60 times never results in overflow.
Robert Toyonaga has updated the pull request incrementally with one additional commit since the last revision:
Add -XX:-UseTLAB to make sampling more reliable. Whitespace.
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/29945/files
- new: https://git.openjdk.org/jdk/pull/29945/files/ec0ec648..66977dc1
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=29945&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=29945&range=00-01
Stats: 14 lines in 2 files changed: 1 ins; 1 del; 12 mod
Patch: https://git.openjdk.org/jdk/pull/29945.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/29945/head:pull/29945
PR: https://git.openjdk.org/jdk/pull/29945
More information about the hotspot-jfr-dev
mailing list