-
Bug
-
Resolution: Fixed
-
P3
-
10, 11, 12, 13
-
All OS' tested display this behaviour.
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8228939 | 12u-cpu | Doug Lea | P3 | Resolved | Fixed | master |
JDK-8223496 | 12.0.2 | Doug Lea | P3 | Resolved | Fixed | b03 |
JDK-8235322 | 11.0.7-oracle | Ivan Gerasimov | P3 | Resolved | Fixed | b01 |
JDK-8223497 | 11.0.4 | Doug Lea | P3 | Resolved | Fixed | b03 |
A bug has been found where cloning a ConcurrentSkipListMap doubles the "size" return value in both original and clone, as a result of the two maps sharing the same size variable (which also causes other problems).
The contents of the maps themselves does not appear to be affected. Clone a map of size 3 and you still have 3 elements in each map post-clone, even though the size() method is not returning 6 for both.
It seems this was caused by the creation of the "adder" variable introduced inJDK-8186226, for JDK10, to track the array size. Since adder is an Object, a shallow clone results in two objects sharing the same variable.
Since the clone process already wipes other variables, it seems a good idea to do the same here.
Code fix and test available.
Webrev for jdk/jdk : http://cr.openjdk.java.net/~afarley/8222930.0/jdk13/webrev/
The contents of the maps themselves does not appear to be affected. Clone a map of size 3 and you still have 3 elements in each map post-clone, even though the size() method is not returning 6 for both.
It seems this was caused by the creation of the "adder" variable introduced in
Since the clone process already wipes other variables, it seems a good idea to do the same here.
Code fix and test available.
Webrev for jdk/jdk : http://cr.openjdk.java.net/~afarley/8222930.0/jdk13/webrev/
- backported by
-
JDK-8223496 ConcurrentSkipListMap.clone() shares size variable between original and clone
- Resolved
-
JDK-8223497 ConcurrentSkipListMap.clone() shares size variable between original and clone
- Resolved
-
JDK-8228939 ConcurrentSkipListMap.clone() shares size variable between original and clone
- Resolved
-
JDK-8235322 ConcurrentSkipListMap.clone() shares size variable between original and clone
- Resolved