sanghyeok An created KAFKA-21720:
------------------------------------
Summary: Stale assignment callback allows a transferred task’s
wall-clock punctuator to execute on the previous member during a Streams
rebalance
Key: KAFKA-21720
URL: https://issues.apache.org/jira/browse/KAFKA-21720
Project: Kafka
Issue Type: Bug
Components: clients, streams
Reporter: sanghyeok An
Assignee: sanghyeok An
With the Streams rebalance protocol, if a new assignment arrives while an
assignment callback is delayed, a task that has already been transferred to
another member can still be initialized on the previous member and execute its
wall-clock punctuator.
{{pendingRevocation}} prevents records from being delivered from the task’s
input partitions, but it does not prevent punctuation. Under
{{{}at_least_once{}}}, output generated by the previous member’s punctuator can
therefore be written to the broker and become visible to downstream consumers.
This behavior was reproduced while both members remained in the group, without
triggering a poll timeout or fencing.
*Steps to Reproduce*
# A receives its initial assignment, which includes task T. Delay completion
of the assignment callback.
# B joins the group.
# Before A’s callback completes, the coordinator assigns T to B. B initializes
T and processes its input records.
# Resume A’s delayed callback. A initializes T based on the stale assignment.
# A’s network thread marks T’s input partitions as {{pendingRevocation}} and
enqueues a revocation callback event. Input record delivery is blocked, but T’s
wall-clock punctuator can execute before the StreamThread handles the
revocation callback.
# The punctuators on A and B each generate output records carrying the same
task identifier.
# After A’s revocation callback completes, read the output topic using a
separate consumer. Output from both members is observable.
*Expected Behavior*
Completion of a stale assignment callback should not allow a task that has
already been transferred to another member to become runnable on the previous
member and generate punctuator output.
*Actual Behavior and Impact*
* Both member IDs remained unchanged, and A’s lost-task callback was not
invoked.
* A did not process input records for the transferred task T.
* T’s wall-clock punctuators executed concurrently on A and B.
* Output from both punctuators was written to the broker and consumed by a
downstream consumer after A’s revocation callback completed.
As a result, task-specific periodic output or scheduled work can be performed
by both the previous owner and the new owner. Subsequent cleanup of the
previous task does not retract output that has already been written.
This reproduction does *not* demonstrate duplicate processing of the same input
record by {{process()}} on two members. A wall-clock punctuator can execute
without receiving an input record. The test demonstrates that punctuators for
the same task on different members can each generate output records that become
visible downstream.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)