[12]RFR 8205399 : Set node color on pinned HashMap.TreeNode deletion
Brent Christian
brent.christian at oracle.com
Wed Aug 8 18:57:22 UTC 2018
Hi,
Please review the following fix.
Bug: https://bugs.openjdk.java.net/browse/JDK-8205399
Webrev: http://cr.openjdk.java.net/~bchristi/8205399/webrev01/
The vmTestbase/vm/gc/containers/Combination05/TestDescription.java test,
which does random adds and removes (via Iterator), has been failing
intermittently with an AssertionError.
I tracked down a couple sequences of operations that trigger the
assertion. Sufficient HashMap collisions convert a bin to a tree, and
then values are deleted using Iterator.remove() (pinned node deletion).
The condition that fails in HashMap.TreeNode.checkInvariants() is:
if (t.red && tl != null && tl.red && tr != null && tr.red)
A red TreeNode should not have two red children.
Many thanks to Doug Lea for providing the fix for the HashMap red/black
tree code. The root node color needs to be set in this case.
Thanks,
-Brent
More information about the core-libs-dev
mailing list