spark-instrumented-optimizer/core/src/main
Josh Rosen eac00691da [SPARK-7766] KryoSerializerInstance reuse is unsafe when auto-reset is disabled
SPARK-3386 / #5606 modified the shuffle write path to re-use serializer instances across multiple calls to DiskBlockObjectWriter. It turns out that this introduced a very rare bug when using `KryoSerializer`: if auto-reset is disabled and reference-tracking is enabled, then we'll end up re-using the same serializer instance to write multiple output streams without calling `reset()` between write calls, which can lead to cases where objects in one file may contain references to objects that are in previous files, causing errors during deserialization.

This patch fixes this bug by calling `reset()` at the start of `serialize()` and `serializeStream()`. I also added a regression test which demonstrates that this problem only occurs when auto-reset is disabled and reference-tracking is enabled.

Author: Josh Rosen <joshrosen@databricks.com>

Closes #6293 from JoshRosen/kryo-instance-reuse-bug and squashes the following commits:

e19726d [Josh Rosen] Add fix for SPARK-7766.
71845e3 [Josh Rosen] Add failing regression test to trigger Kryo re-use bug
2015-05-22 13:28:14 -07:00
..
java/org/apache/spark [SPARK-7081] Faster sort-based shuffle path using binary processing cache-aware sort 2015-05-13 17:07:31 -07:00
resources/org/apache/spark [SPARK-7501] [STREAMING] DAG visualization: show DStream operations 2015-05-18 14:33:33 -07:00
scala/org/apache/spark [SPARK-7766] KryoSerializerInstance reuse is unsafe when auto-reset is disabled 2015-05-22 13:28:14 -07:00