[ 
https://issues.apache.org/jira/browse/KAFKA-21485?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Chang updated KAFKA-21485:
-------------------------------
    Description: 
{{KafkaShareConsumer#commitSync(Duration)}} can block longer than the given 
timeout. If the background thread does not complete the commit future, 
{{commitSync}} keeps waiting.

{{ShareConsumerImpl}} waits with {{ConsumerUtils.getResult(commitFuture)}}, 
which calls {{Future#get()}} with no timeout. {{AsyncKafkaConsumer#commitSync}} 
passes the timer: {{getResult(commitFuture, requestTimer)}}. The share consumer 
should do the same.

  was:
{{ShareConsumerImpl#commitSync(Duration)}} waits for the result with 
{{ConsumerUtils.getResult(commitFuture)}}. This calls {{Future#get()}} without 
a timeout.

The application thread returns only when the background thread completes the 
future. This happens when the response arrives, when the request expires in 
{{ShareConsumeRequestManager}}, or when {{CompletableEventReaper}} expires the 
event. The reaper runs once per loop of the background thread, and one loop can 
take up to 5 seconds. So {{commitSync(Duration)}} can return much later than 
the given timeout. If the background thread is stuck, it does not return.

{{AsyncKafkaConsumer#commitSync}} uses {{ConsumerUtils.getResult(commitFuture, 
requestTimer)}}. The share consumer should do the same.

Note: on timeout, {{commitSync}} now either throws {{TimeoutException}} 
(reaper) or returns a map with {{TimeoutException}} for each partition (request 
manager). The javadoc does not say which one is expected.


> KafkaShareConsumer#commitSync(Duration) can block longer than the given 
> timeout
> -------------------------------------------------------------------------------
>
>                 Key: KAFKA-21485
>                 URL: https://issues.apache.org/jira/browse/KAFKA-21485
>             Project: Kafka
>          Issue Type: Bug
>          Components: clients, consumer
>    Affects Versions: 4.0.0, 4.1.0, 4.2.0, 4.3.0, 4.4.0
>            Reporter: Eric Chang
>            Assignee: Eric Chang
>            Priority: Major
>
> {{KafkaShareConsumer#commitSync(Duration)}} can block longer than the given 
> timeout. If the background thread does not complete the commit future, 
> {{commitSync}} keeps waiting.
> {{ShareConsumerImpl}} waits with {{ConsumerUtils.getResult(commitFuture)}}, 
> which calls {{Future#get()}} with no timeout. 
> {{AsyncKafkaConsumer#commitSync}} passes the timer: {{getResult(commitFuture, 
> requestTimer)}}. The share consumer should do the same.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to