Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 2F9BC200CD8 for ; Wed, 2 Aug 2017 10:48:51 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 2DF76169094; Wed, 2 Aug 2017 08:48:51 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 72BE1169093 for ; Wed, 2 Aug 2017 10:48:50 +0200 (CEST) Received: (qmail 84224 invoked by uid 500); 2 Aug 2017 08:48:49 -0000 Mailing-List: contact dev-help@atlas.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@atlas.apache.org Delivered-To: mailing list dev@atlas.apache.org Received: (qmail 84213 invoked by uid 99); 2 Aug 2017 08:48:48 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Aug 2017 08:48:48 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 2A352C0C1B; Wed, 2 Aug 2017 08:48:48 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3.001 X-Spam-Level: *** X-Spam-Status: No, score=3.001 tagged_above=-999 required=6.31 tests=[HEADER_FROM_DIFFERENT_DOMAINS=0.001, HTML_MESSAGE=2, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id zm4oOLkndiXH; Wed, 2 Aug 2017 08:48:37 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 3CB675FB3A; Wed, 2 Aug 2017 08:48:36 +0000 (UTC) Received: from reviews.apache.org (unknown [10.41.0.12]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 992E4E0012; Wed, 2 Aug 2017 08:48:35 +0000 (UTC) Received: from reviews-vm2.apache.org (localhost [IPv6:::1]) by reviews.apache.org (ASF Mail Server at reviews-vm2.apache.org) with ESMTP id 4A364C400D8; Wed, 2 Aug 2017 08:48:33 +0000 (UTC) Content-Type: multipart/alternative; boundary="===============1270969783914260955==" MIME-Version: 1.0 Subject: Re: Review Request 61274: ATLAS-1944 - Fix for ConcurrentModificationException Exception in HookConsumer (KafkaConsumer) while stopping Atlas server From: Nixon Rodrigues To: Apoorv Naik , Madhan Neethiraj , Ashutosh Mestry , Sarath Subramanian Cc: atlas , Nixon Rodrigues Date: Wed, 02 Aug 2017 08:48:33 -0000 Message-ID: <20170802084833.16835.62314@reviews-vm2.apache.org> X-ReviewBoard-URL: https://reviews.apache.org/ Auto-Submitted: auto-generated Sender: Nixon Rodrigues X-ReviewGroup: atlas X-Auto-Response-Suppress: DR, RN, OOF, AutoReply X-ReviewRequest-URL: https://reviews.apache.org/r/61274/ X-Sender: Nixon Rodrigues References: <20170801110739.55967.55806@reviews-vm2.apache.org> In-Reply-To: <20170801110739.55967.55806@reviews-vm2.apache.org> Reply-To: Nixon Rodrigues X-ReviewRequest-Repository: atlas archived-at: Wed, 02 Aug 2017 08:48:51 -0000 --===============1270969783914260955== MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/61274/ ----------------------------------------------------------- (Updated Aug. 2, 2017, 8:48 a.m.) Review request for atlas, Apoorv Naik, Ashutosh Mestry, Madhan Neethiraj, and Sarath Subramanian. Changes ------- This patch handles review comments from Apoorv and Ashutosh. After adding extended HookConsumer from ShutdownableThread and calling consumer.shutdown(), closing of kafkaconsumer was happening fine before timeout of consumer thread.so added back the ShutdownableThread implementation in this patch. Bugs: ATLAS-1944 https://issues.apache.org/jira/browse/ATLAS-1944 Repository: atlas Description ------- Background:- NotificationHookConsumer was throwing ConcurrentModificationException exception while shutting down the consumer thread. The stop method of thread was calling the kafkacosumer.stop method while in run method of HookConsumer which is busy in cosuming the kafka message by polling kafka server. This simaltanous action of stoping and polling causes ConcurrentModificationException. Fix:- * Added try finally block in run method which wraps the while loop and when loop ends the finally blocks calls the consumer close method is called which ensures that close is called after consuming is ended. * Replaced the ShutdownThread interface which was delaying the shutdown process of consumer with Runnable interface used earlier. Reference : - https://kafka.apache.org/090/javadoc/index.html?org/apache/kafka/clients/consumer/KafkaConsumer.html Diffs (updated) ----- notification/src/main/java/org/apache/atlas/kafka/AtlasKafkaConsumer.java d431176 notification/src/main/java/org/apache/atlas/notification/NotificationConsumer.java 0bd75e1 notification/src/test/java/org/apache/atlas/notification/AbstractNotificationConsumerTest.java bcee00c webapp/src/main/java/org/apache/atlas/notification/NotificationHookConsumer.java 51276d3 Diff: https://reviews.apache.org/r/61274/diff/2/ Changes: https://reviews.apache.org/r/61274/diff/1-2/ Testing ------- Tested the Atlas kafkaconsumer from hive hook and shutdown of atlas server to check if there is issue while shutdown process. Unit test and integration test are passing. Thanks, Nixon Rodrigues --===============1270969783914260955==--