KMeans uses accumulators to compute the cost of a clustering at each iteration.
Each time a ShuffleMapTask completes, it increments the accumulators at the driver. If a task runs twice because of failures, the accumulators get incremented twice.
KMeans uses accumulators in ShuffleMapTasks. This means that a task's cost can end up being double-counted.