[ https://issues.apache.org/jira/browse/KAFKA-2799?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15027502#comment-15027502 ]
Guozhang Wang commented on KAFKA-2799: -------------------------------------- [~granthenke] Thanks for reporting this. It is in fact missed in 0.9.0 branch, I have just cherry picked from trunk to be included in the 0.9.0.1 release. > 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.1 > > > 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)