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 2020/12/01 23:52:18 UTC

[GitHub] [kafka] ncliang commented on a change in pull request #9669: KAFKA-10792: Prevent source task shutdown from blocking herder thread

ncliang commented on a change in pull request #9669:
URL: https://github.com/apache/kafka/pull/9669#discussion_r533788764



##########
File path: connect/runtime/src/main/java/org/apache/kafka/connect/runtime/WorkerSourceTask.java
##########
@@ -206,16 +203,13 @@ public void cancel() {
     public void stop() {
         super.stop();
         stopRequestedLatch.countDown();
-        synchronized (this) {
-            if (finishedStart)
-                tryStop();
-            else
-                startedShutdownBeforeStartCompleted = true;
-        }
     }
 
-    private synchronized void tryStop() {
-        if (!stopped) {
+    // Note: This method is not thread-safe
+    private void tryStop() {
+        // If the task is scheduled for shutdown before we invoke initialize or start on it (which
+        // can happy reliably if it's started in the PAUSED state), we don't have to invoke stop on it

Review comment:
       ```suggestion
           // can happen reliably if it's started in the PAUSED state), we don't have to invoke stop on it
   ```




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