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

Geert Pante commented on KAFKA-3720:
------------------------------------

[~sliebau], [~mgharat] 

??An open question is whether this exception should be re-thrown in the 
producer, or returned in the Future. As this exception would be thrown in code 
that runs within max.block.ms a case could be made that this is still the 
synchroneous part of the send process and the exception should be thrown.??

??However, as the current implementation is to return the exception in the 
Future, I do not think we should change this without advance notice, as it has 
the potential to break user code.??

 

I checked this with Kafka 2.2.1, by setting the buffer size to 64kB and the 
max.block.ms to 10ms, and found that the exception is actually thrown from the 
producer.send() method, not in the callback. The future is not even returned. I 
do see that in the existing tests for 2.6, it's assumed the exception is thrown 
in the future.

I think the current behaviour in 2.2.1 is more useful. Even if you ignore the 
returned future, senders will still receive back-pressure so they will not 
continue to try to send messages when the buffer is full anyway. And it makes 
sense to receive a timeout exception on the same call if that back-pressure 
goes over the max.block.ms limit. Checking the returned future should only be 
necessary if you want to wait until the message is effectively sent.

> Remove BufferExhaustedException from doSend() in KafkaProducer
> --------------------------------------------------------------
>
>                 Key: KAFKA-3720
>                 URL: https://issues.apache.org/jira/browse/KAFKA-3720
>             Project: Kafka
>          Issue Type: Bug
>          Components: producer 
>    Affects Versions: 2.4.1
>            Reporter: Mayuresh Gharat
>            Assignee: Sönke Liebau
>            Priority: Minor
>             Fix For: 2.6.0
>
>
> KafkaProducer no longer throws BufferExhaustException. We should remove it 
> from the catch clause. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to