Copilot commented on code in PR #23004:
URL: https://github.com/apache/kafka/pull/23004#discussion_r3983118258
##########
streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java:
##########
@@ -496,13 +497,23 @@ private void replaceStreamThread(final Throwable
throwable) {
log.error("Encountered the following exception during processing "
+
" The streams client is going to shut down now. ",
throwable);
closeToError();
+ return;
}
+
final StreamThread deadThread = (StreamThread) Thread.currentThread();
+
// Use DEFAULT so the consumer layer decides: classic protocol maps to
REMAIN_IN_GROUP
// (avoiding an unnecessary rebalance before the replacement thread
joins), while Streams
// protocol adapts to static vs dynamic membership.
-
deadThread.shutdown(org.apache.kafka.streams.CloseOptions.GroupMembershipOperation.DEFAULT);
- addStreamThread();
+ if (deadThread.shutdown(GroupMembershipOperation.DEFAULT)) {
+ addStreamThread();
Review Comment:
The new ownership branch is not exercised by the regression tests: they
coordinate two removals, but never run the `REPLACE_THREAD` handler while a
removal wins `shutdown()`. A targeted test should verify both outcomes here—an
initiated shutdown adds a replacement, while an already-requested shutdown does
not—so the deadlock fix cannot regress into silently undoing a removal.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]