ccding commented on a change in pull request #10579: URL: https://github.com/apache/kafka/pull/10579#discussion_r664630725
########## 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: Is it possible two threads call `close()` concurrently? -- 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