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

ASF GitHub Bot commented on KAFKA-4387:
---------------------------------------

GitHub user srdo opened a pull request:

    https://github.com/apache/kafka/pull/2110

    KAFKA-4387: Fix KafkaConsumer not responding correctly to interrupts,…

    ... throw InterruptException from blocking methods when interrupted
    
    See https://issues.apache.org/jira/browse/KAFKA-4387

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/srdo/kafka KAFKA-4387

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/kafka/pull/2110.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2110
    
----
commit a3b8303bf33c24eb51130e1a4d1cd7d17771fecd
Author: Stig Rohde Døssing <s...@it-minds.dk>
Date:   2016-11-07T19:09:22Z

    KAFKA-4387: Fix KafkaConsumer not responding correctly to interrupts, throw 
InterruptException from blocking methods when interrupted

----


> KafkaConsumer will enter an infinite loop if the polling thread is 
> interrupted, and either commitSync or committed is called
> ----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: KAFKA-4387
>                 URL: https://issues.apache.org/jira/browse/KAFKA-4387
>             Project: Kafka
>          Issue Type: Bug
>          Components: clients
>    Affects Versions: 0.10.0.1
>            Reporter: Stig Rohde Døssing
>            Assignee: Stig Rohde Døssing
>
> When the KafkaConsumer.commitSync method is called, the 
> ConsumerNetworkClient.poll(RequestFuture<?> future) method will be called 
> with a future that only finishes when the commit request completes, or the 
> request times out.
> When the calling thread is interrupted, every call to the Selector underlying 
> the ConsumerNetworkClient will return immediately, while thread interrupt 
> state is not reset. The call to poll ends up looping until the request 
> timeout, at which point it drops back out to 
> ConsumerCoordinator.commitOffsetsSync which retries the request because 
> TimeoutException is retriable. This repeats indefinitely. 
> For the same reason as in https://issues.apache.org/jira/browse/KAFKA-4375, 
> it is good if the KafkaConsumer can handle interrupts in a reasonable way, 
> rather than having wakeup() be the only way to properly stop a consumer 
> thread.
> I think making ConsumerNetworkClient.maybeTriggerWakeup() throw a 
> WakeupException if the calling thread is interrupted makes sense, since an 
> interrupted thread won't be making progress in polling due to the way 
> Selector works, and KafkaConsumer users then don't have to handle wakeups and 
> interrupts separately.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to