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/08 10:54:45 UTC

[GitHub] [kafka] g1geordie commented on a change in pull request #9707: KAFKA-10790 Detect/Prevent Deadlock on Producer Network Thread

g1geordie commented on a change in pull request #9707:
URL: https://github.com/apache/kafka/pull/9707#discussion_r538239661



##########
File path: clients/src/test/java/org/apache/kafka/clients/producer/KafkaProducerTest.java
##########
@@ -391,6 +391,23 @@ Sender newSender(LogContext logContext, KafkaClient kafkaClient, ProducerMetadat
         };
     }
 
+    @Test(timeout = 10000)
+    public void testFlushInCallbackNotCauseDeadlock() throws InterruptedException {
+        Map<String, Object> configs = new HashMap<>();
+        configs.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9999");
+        ProducerMetadata metadata = mock(ProducerMetadata.class);
+
+        when(metadata.fetch()).thenReturn(emptyCluster, emptyCluster, emptyCluster, onePartitionCluster);
+
+        KafkaProducer<String, String> producer = producerWithOverrideNewSender(configs, metadata);
+        ProducerRecord<String, String> record = new ProducerRecord<>(topic, "value");
+
+        producer.send(record, (metadata1, exception) -> producer.flush());

Review comment:
       Thank you  . I add a Assert.fail after flush 




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