RFR: 8309890: TestStringDeduplicationInterned.java waits for the wrong condition

Kim Barrett kbarrett at openjdk.org
Tue Jun 13 07:22:41 UTC 2023


On Tue, 13 Jun 2023 05:48:32 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

> There's a section in the test that waits up to 10 seconds for a string to be deduplicated and then does a final verification that the string was correctly deduplicated. However, the initial waiting gets passed the wrong comparison string, which has the effect that this test always waits for 10 seconds before proceeding.
> 
> The problem is here:
> 
>             if (!waitForDeduplication(dupString3, baseString)) {
>                 if (getValue(dupString3) != getValue(internedString)) {
> 
> where the first line should say:
> 
>             if (!waitForDeduplication(dupString3, internedString)) {

Changes requested by kbarrett (Reviewer).

test/hotspot/jtreg/gc/stringdedup/TestStringDeduplicationTools.java line 396:

> 394: 
> 395:             if (!waitForDeduplication(dupString3, internedString)) {
> 396:                 if (getValue(dupString3) != getValue(internedString)) {

This line is no longer needed.  waitForDeduplication returns false if the two strings underlying char arrays
(returned by getValue) don't become equal during the waiting period.  So unless it just happened that they
became equal after waitForDeduplication gave up but before this check, this check will fail.

-------------

PR Review: https://git.openjdk.org/jdk/pull/14437#pullrequestreview-1476427449
PR Review Comment: https://git.openjdk.org/jdk/pull/14437#discussion_r1227643884


More information about the hotspot-gc-dev mailing list