Matthias J. Sax created KAFKA-21549:
---------------------------------------
Summary: StoreChangelogReader throws NullPointerException for a
paused standby task when committed offsets cannot be fetched
Key: KAFKA-21549
URL: https://issues.apache.org/jira/browse/KAFKA-21549
Project: Kafka
Issue Type: Bug
Components: streams
Reporter: Matthias J. Sax
Paused tasks stay registered in StoreChangelogReader#changelogs, but restore()
only receives the updating tasks. maybeUpdateLimitOffsetsForStandbyChangelogs()
picks its partitions from all registered changelogs, including those of paused
standby tasks:
{code:java}
final Set<TopicPartition> changelogsWithLimitOffsets =
changelogs.entrySet().stream().filter(
entry -> entry.getValue().stateManager.taskType() == Task.TaskType.STANDBY
&&
entry.getValue().stateManager.changelogAsSource(entry.getKey()))
.map(Map.Entry::getKey).collect(Collectors.toSet());
{code}
If listConsumerGroupOffsets() fails with a retriable exception,
committedOffsetForChangelogs() calls getTasksFromPartitions(). For a paused
task, tasks.get() returns null, so null ends up in the task set, and
maybeInitTaskTimeoutOrThrow() dereferences it:
{code:java}
tasks.forEach(t -> t.maybeInitTaskTimeoutOrThrow(now, cause)); {code}
clearTaskTimeout() guards against null, but maybeInitTaskTimeoutOrThrow() does
not. The NullPointerException kills the state updater thread.
changelogsWithLimitOffsets should only contain changelogs of tasks in tasks,
the same check fetchableChangelogs() makes.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)