[ https://issues.apache.org/jira/browse/KAFKA-2799?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14999374#comment-14999374 ]
ASF GitHub Bot commented on KAFKA-2799: --------------------------------------- GitHub user guozhangwang opened a pull request: https://github.com/apache/kafka/pull/490 KAFKA-2799: skip wakeup in the follow-up poll() call. You can merge this pull request into a Git repository by running: $ git pull https://github.com/guozhangwang/kafka K2799 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/kafka/pull/490.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 #490 ---- commit f9dd6ffbfa975ab454b84c43c722767d74d572ed Author: Guozhang Wang <wangg...@gmail.com> Date: 2015-11-10T21:32:07Z v1 ---- > WakupException thrown in the followup poll() could lead to data loss > -------------------------------------------------------------------- > > Key: KAFKA-2799 > URL: https://issues.apache.org/jira/browse/KAFKA-2799 > Project: Kafka > Issue Type: Bug > Reporter: Guozhang Wang > Assignee: Guozhang Wang > Priority: Blocker > Fix For: 0.9.0.0 > > > The common pattern of the new consumer: > {code} > try { > records = consumer.poll(); > // process records > } catch (WakeupException) { > consumer.close() > } > {code} > in which the close() can commit offsets. But since in the poll() call, we do > the following order: > 1) trigger client.poll(). > 2) possibly update consumed position if there are some data from fetch > response. > 3) before return the records, possibly trigger another client.poll() > And if wakeup exception is thrown in 3) it will lead to not-returned messages > to be committed hence data loss. -- This message was sent by Atlassian JIRA (v6.3.4#6332)