Return-Path: X-Original-To: apmail-kafka-dev-archive@www.apache.org Delivered-To: apmail-kafka-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5C90519F63 for ; Mon, 4 Apr 2016 05:42:26 +0000 (UTC) Received: (qmail 23992 invoked by uid 500); 4 Apr 2016 05:42:25 -0000 Delivered-To: apmail-kafka-dev-archive@kafka.apache.org Received: (qmail 23896 invoked by uid 500); 4 Apr 2016 05:42:25 -0000 Mailing-List: contact dev-help@kafka.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@kafka.apache.org Delivered-To: mailing list dev@kafka.apache.org Received: (qmail 23885 invoked by uid 99); 4 Apr 2016 05:42:25 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Apr 2016 05:42:25 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 714982C1F5C for ; Mon, 4 Apr 2016 05:42:25 +0000 (UTC) Date: Mon, 4 Apr 2016 05:42:25 +0000 (UTC) From: "Guozhang Wang (JIRA)" To: dev@kafka.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (KAFKA-3491) Issue with consumer close() in finally block with 'enable.auto.commit=true' MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/KAFKA-3491?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15223685#comment-15223685 ] Guozhang Wang commented on KAFKA-3491: -------------------------------------- "if it's actually a good feature to provide": what feature are you referring to? > Issue with consumer close() in finally block with 'enable.auto.commit=true' > --------------------------------------------------------------------------- > > Key: KAFKA-3491 > URL: https://issues.apache.org/jira/browse/KAFKA-3491 > Project: Kafka > Issue Type: Bug > Components: consumer > Affects Versions: 0.9.0.0, 0.9.0.1 > Reporter: dan norwood > Assignee: Jason Gustafson > Priority: Minor > > imagine you have a run loop that looks like the following: > {code:java} > public void run() { > try { > consumer.subscribe(topics); > while (true) { > ConsumerRecords records = consumer.poll(Long.MAX_VALUE); > records.forEach(record -> process(record)); > } > } catch (WakeupException e) { > // ignore, we're closing > } catch (Exception e) { > log.error("Unexpected error", e); > } finally { > consumer.close(); > } > } > {code} > if you run this with 'enable.auto.commit=true' and throw an exception in the 'process()' method you will still try to commit all the read, but unprocessed, offsets in the most recent batch. -- This message was sent by Atlassian JIRA (v6.3.4#6332)