Race condition when serializing SerializedRandomAccessList
Krystal Mok
rednaxelafx at gmail.com
Fri Aug 3 18:34:11 UTC 2018
Hi core-libs,
I'd like to report a bug on race condition while serializing
SerializedRandomAccessList / deserializing SerializedList. This seems to be
a long standing bug, we've hit it on JDK8 and the same code is still there
in JDK11's core-lib.
In SerializedRandomAccessList.writeReplace(): [1]
private Object writeReplace() {
return new SynchronizedList<>(list);
}
Here, it's creating a new "face" of the current SerializedRandomAccessList,
but not passing down this.mutex into the newly created SynchronizedList.
What we've seen go wrong was that one thread was still appending to the
SerializedRandomAccessList, while another thread is trying to serialize it,
a ConcurrentModificationException may be thrown on the underlying list.
I've filed JDK-8208779 [2] to track this issue.
Note: this issue was reported by my colleague Shixiong Zhu at Databricks.
I'm just delegating the report to the core-libs list.
One past occurrence of the same issue can be found in Apache Spark in [3].
Thanks,
Kris
[1]:
http://hg.openjdk.java.net/jdk/jdk11/file/4322ef0c1684/src/java.base/share/classes/java/util/Collections.java#l2521
[2]: https://bugs.openjdk.java.net/browse/JDK-8208779
[3]:
https://issues.apache.org/jira/browse/SPARK-17463?focusedCommentId=15787809&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-15787809
More information about the core-libs-dev
mailing list