Integrated: 8336926: jdk/internal/util/ReferencedKeyTest.java can fail with ConcurrentModificationException
Roger Riggs
rriggs at openjdk.org
Thu Aug 8 16:56:36 UTC 2024
On Wed, 7 Aug 2024 19:26:59 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
> The original test fails intermittently, the reproducer failed consistently.
> With the fix, the failure was not observed in the test or reproducer.
>
> In jdk.internal.util.ReferencedKeyMap.entrySet() and toString() methods, avoid removing stale references that would modify the keyset while it is being iterated over.
> If GC removes the key, iterating or streaming over the keyset might get a ConcurrentModificationException.
This pull request has now been integrated.
Changeset: bfb75b96
Author: Roger Riggs <rriggs at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/bfb75b96266f4c5840e2edea13f9aa2c801518cf
Stats: 11 lines in 1 file changed: 7 ins; 1 del; 3 mod
8336926: jdk/internal/util/ReferencedKeyTest.java can fail with ConcurrentModificationException
Reviewed-by: bpb, shade, dfuchs
-------------
PR: https://git.openjdk.org/jdk/pull/20499
More information about the core-libs-dev
mailing list