Matthias J. Sax created KAFKA-21615:
---------------------------------------
Summary: State updater dies with IllegalStateException when a
paused task's changelog is corrupted
Key: KAFKA-21615
URL: https://issues.apache.org/jira/browse/KAFKA-21615
Project: Kafka
Issue Type: Bug
Components: streams
Reporter: Matthias J. Sax
A paused task keeps its changelogs registered and assigned to the restore
consumer (DefaultStateUpdater#pauseTask). StoreChangelogReader pauses those
partitions on the restore consumer, but the consumer can still raise an
InvalidOffsetException for them:
# A fetch that was in flight when the task was paused returns
OFFSET_OUT_OF_RANGE. FetchCollector#collectFetch initializes the completed
fetch before it checks isPaused().
# Position validation after a leader change detects truncation.
partitionsNeedingValidation() does not filter paused partitions.
StoreChangelogReader#pollRecordsFromRestoreConsumer turns this into a
TaskCorruptedException that names the paused task.
DefaultStateUpdater#handleTaskCorruptedException looks the task up only in
updatingTasks:
{code:java}
final Task corruptedTask = updatingTasks.get(taskId);
if (corruptedTask == null) {
throw new IllegalStateException("Task " + taskId + " is corrupted but is
not updating. " + BUG_ERROR_MESSAGE);
}
{code}
The IllegalStateException is fatal for the state updater thread, so every task
fails. handleStreamsExceptionWithTask already handles a failed task that is in
pausedTasks.
*Proposed fix:* handle a corrupted task in pausedTasks the same way as an
updating one (mark its changelogs corrupted, checkpoint, unregister them), and
remove it with addToExceptionsAndFailedTasksThenRemoveFromPausedTasks.
Reported by [~chia7712] on
[https://github.com/apache/kafka/pull/24256#discussion_r4647307674].
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)