You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2021/02/02 13:28:25 UTC

[GitHub] [kafka] C0urante commented on a change in pull request #10016: KAFKA-10340: Proactively close producer when cancelling source tasks

C0urante commented on a change in pull request #10016:
URL: https://github.com/apache/kafka/pull/10016#discussion_r568599861



##########
File path: connect/runtime/src/main/java/org/apache/kafka/connect/runtime/WorkerSourceTask.java
##########
@@ -171,13 +171,9 @@ protected void close() {
                 log.warn("Could not stop task", t);
             }
         }
-        if (producer != null) {
-            try {
-                producer.close(Duration.ofSeconds(30));
-            } catch (Throwable t) {
-                log.warn("Could not close producer", t);
-            }
-        }
+
+        closeProducer(30);
+
         if (admin != null) {

Review comment:
       I wanted to keep things focused here. We know that there's an edge case with the producer that can cause it to hang forever in `send`, and we're addressing that. As far as I know, there is no such case with the admin client, so closing the admin client proactively seems unnecessary. Although there could be an issue with a transformation chain blocking, there's no guarantee that invoking `close` on it is going to fix anything since a transform blocked on, e.g., input/output could remain blocked on that even after being `closed` from another thread.
   
   Ultimately, if a similar case comes up where follow-up is necessary, we can consider our options then based on the particulars of the situation. Right now we only have one specific problem to solve, and I think a targeted approach that doesn't unnecessarily change things is best for that.
   
   If nothing else, maybe a comment explaining why the producer gets special treatment here would be beneficial.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org