[ 
https://issues.apache.org/jira/browse/KAFKA-8178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17522550#comment-17522550
 ] 

Guozhang Wang commented on KAFKA-8178:
--------------------------------------

I think it's fair to update the docs to explicitly state that producer.send() 
call can be blocked when 1) memory is full, indicating the send thread cannot 
keep up with the caller thread's append speed, 2) metadata is not available to 
determine which partition the record should go. And in practice there are 
various reasons either 1) or 2) could be triggered, for example: a) producer 
client is throttled at the broker, b) broker cluster is un-healthy and hence 
cannot respond with either metadata or produce requests, c) more...

> KafkaProducer#send(ProducerRecord,Callback) may block for up to 60 seconds
> --------------------------------------------------------------------------
>
>                 Key: KAFKA-8178
>                 URL: https://issues.apache.org/jira/browse/KAFKA-8178
>             Project: Kafka
>          Issue Type: Bug
>          Components: clients, producer 
>            Reporter: Sergei Egorov
>            Priority: Major
>
> Hello. I was running reactor-kafka with [the BlockHound 
> agent|https://github.com/reactor/BlockHound] (you can see the progress 
> [here|https://github.com/reactor/reactor-kafka/pull/75] and even run it 
> yourself) and it detected a very dangerous blocking call in 
> KafkaProducer#send(ProducerRecord,Callback) which is supposed to be async:
> {code:java}
> java.lang.Error: Blocking call! java.lang.Object#wait
>       at reactor.BlockHound$Builder.lambda$new$0(BlockHound.java:154)
>       at reactor.BlockHound$Builder.lambda$install$8(BlockHound.java:254)
>       at reactor.BlockHoundRuntime.checkBlocking(BlockHoundRuntime.java:43)
>       at java.lang.Object.wait(Object.java)
>       at org.apache.kafka.clients.Metadata.awaitUpdate(Metadata.java:181)
>       at 
> org.apache.kafka.clients.producer.KafkaProducer.waitOnMetadata(KafkaProducer.java:938)
>       at 
> org.apache.kafka.clients.producer.KafkaProducer.doSend(KafkaProducer.java:823)
>       at 
> org.apache.kafka.clients.producer.KafkaProducer.send(KafkaProducer.java:803)
> {code}
> it blocks for up to "maxBlockTimeMs" (60 seconds by default)



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to