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



##########
File path: 
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/WorkerConnector.java
##########
@@ -266,31 +422,51 @@ public void close() {
         @Override
         public void onStartup(String connector) {
             state = AbstractStatus.State.RUNNING;
-            delegate.onStartup(connector);
+            synchronized (this) {

Review comment:
       The locking here is to ensure that, upon being cancelled, the very last 
status update that this connector makes is to set its state to `UNASSIGNED`.
   
   There's a potential race if its status is scheduled to be updated to, e.g., 
`PAUSED` and the check for `cancelled` goes through because it isn't set to 
`true` yet, then the task gets cancelled on another thread and its status gets 
set to `UNASSIGNED`, then the original thread proceeds with execution and sets 
the status to `PAUSED`.




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to