ZequnLin created SPARK-62400:
--------------------------------
Summary: BlockManager.getLocalValues deletes a healthy disk block
when the reading task is interrupted, losing local-checkpoint data
Key: SPARK-62400
URL: https://issues.apache.org/jira/browse/SPARK-62400
Project: Spark
Issue Type: Bug
Components: Spark Core, Block Manager
Affects Versions: 4.3.0, 5.0.0
Reporter: ZequnLin
SPARK-39152 made {{BlockManager.getLocalValues}} remove a block when reading it
from disk fails with an IO error (an {{IOException}}, or a {{KryoException}}
caused by one), so the driver learns the block is gone.
An interrupt during that read can also surface as an {{IOException}}. When a
task is killed, for example by task cancellation, speculation, or AQE
cancelling stages it no longer needs, the reading thread is interrupted. If it
is blocked in an interruptible channel read, the JDK closes the channel and
throws {{ClosedByInterruptException}}, a subclass of {{IOException}}.
{{getLocalValues}} then deletes a block file that is not damaged.
For a cached RDD block, the cost is a recompute. For a block written by
{{RDD.localCheckpoint()}} / {{Dataset.localCheckpoint()}}, the deleted block is
the only copy and its lineage has been truncated. The next reader fails with
{{CHECKPOINT_RDD_BLOCK_ID_NOT_FOUND}} ("Checkpoint block rdd_X_Y not found!
Either the executor that originally checkpointed this partition is no longer
alive, or the original RDD is unpersisted."), even though no executor was lost
and the RDD was not unpersisted.
We saw this in production: a stage cancellation interrupted tasks that were
reading local-checkpoint blocks from disk. The executor logged {{INFO
BlockManager: null. BlockManagerId(...) - blockId: rdd_X_Y - blockDiskPath:
...}} (the SPARK-39152 log line with a null exception message) and removed the
block. The next job that used the checkpoint failed.
Proposed fix: in {{getLocalValues}}, do not remove the block when the failed
read was caused by an interrupt, that is, when the cause chain contains
{{ClosedByInterruptException}}, {{InterruptedIOException}} or
{{InterruptedException}}, the current thread is interrupted, or the task
context is interrupted. Still rethrow the exception. Genuine IO errors on reads
that are not interrupted keep the SPARK-39152 behavior.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]