satishd commented on a change in pull request #10579:
URL: https://github.com/apache/kafka/pull/10579#discussion_r664980913



##########
File path: 
storage/src/main/java/org/apache/kafka/server/log/remote/metadata/storage/ConsumerTask.java
##########
@@ -220,16 +227,16 @@ public boolean isPartitionAssigned(int partition) {
         return assignedMetaPartitions.contains(partition);
     }
 
-    private void ensureNotClosed() {
-        if (closing) {
-            throw new IllegalStateException("This instance is already closed");
-        }
-    }
-
     public void close() {
         if (!closing) {
-            closing = true;
-            consumer.wakeup();
+            synchronized (assignPartitionsLock) {
+                // Closing should be updated only after acquiring the lock to 
avoid race in
+                // maybeWaitForPartitionsAssignment() where it waits on 
assignPartitionsLock. It should not wait
+                // if the closing is already set.
+                closing = true;

Review comment:
       `close()` will not be called concurrently here. 




-- 
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: jira-unsubscr...@kafka.apache.org

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


Reply via email to