chia7712 commented on a change in pull request #8657:
URL: https://github.com/apache/kafka/pull/8657#discussion_r484039528



##########
File path: 
core/src/test/scala/unit/kafka/coordinator/AbstractCoordinatorConcurrencyTest.scala
##########
@@ -201,8 +201,8 @@ object AbstractCoordinatorConcurrencyTest {
         }
       }
       val producerRequestKeys = 
entriesPerPartition.keys.map(TopicPartitionOperationKey(_)).toSeq
-      watchKeys ++= producerRequestKeys
       producePurgatory.tryCompleteElseWatch(delayedProduce, 
producerRequestKeys)
+      watchKeys ++= producerRequestKeys

Review comment:
       > Another possibly is that we hold the lock in delayed operation while 
adding the operation to watch list and do the final safeTryComplete() check. 
This way, when the delayed operation is exposed to another thread, every 
thread, including the caller, always first acquires the lock in delayed 
operation. This should avoid all potential deadlocks between 
tryCompleteElseWatch() and checkAndComplete()
   
   nice idea. I have addressed this approach.




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