From dev-return-8943-archive-asf-public=cust-asf.ponee.io@curator.apache.org Mon Mar 26 10:50:05 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 54C57180671 for ; Mon, 26 Mar 2018 10:50:05 +0200 (CEST) Received: (qmail 68055 invoked by uid 500); 26 Mar 2018 08:50:04 -0000 Mailing-List: contact dev-help@curator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@curator.apache.org Delivered-To: mailing list dev@curator.apache.org Received: (qmail 68044 invoked by uid 99); 26 Mar 2018 08:50:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Mar 2018 08:50:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id D271B1A015E for ; Mon, 26 Mar 2018 08:50:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -101.511 X-Spam-Level: X-Spam-Status: No, score=-101.511 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id TzeqpJT7dO3H for ; Mon, 26 Mar 2018 08:50:02 +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 9FDA65F58A for ; Mon, 26 Mar 2018 08:50:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id C3467E0DE0 for ; Mon, 26 Mar 2018 08:50:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 3A3CD214FC for ; Mon, 26 Mar 2018 08:50:00 +0000 (UTC) Date: Mon, 26 Mar 2018 08:50:00 +0000 (UTC) From: "Cameron McKenzie (JIRA)" To: dev@curator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Assigned] (CURATOR-460) Timed tolerance for connection suspended leads to simultaneous leaders MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CURATOR-460?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:all-tabpanel ] Cameron McKenzie reassigned CURATOR-460: ---------------------------------------- Assignee: Cameron McKenzie > Timed tolerance for connection suspended leads to simultaneous leaders > ---------------------------------------------------------------------- > > Key: CURATOR-460 > URL: https://issues.apache.org/jira/browse/CURATOR-460 > Project: Apache Curator > Issue Type: Bug > Components: Recipes > Affects Versions: 3.3.0, 4.0.0, 4.0.1 > Reporter: Antonio Rafael Rodrigues > Assignee: Cameron McKenzie > Priority: Major > > Starting from Curator 3, after losing the connection to zookeeper, curato= r emits a SUSPENDED event and then starts an internal timer, if the time of= the negotiatied session timeout get hit and curator didn't reconnect to zo= okeeper it emits a LOST event. > For example : > Given negotiated session timeout =3D 40 > ||Time (seconds)||Event|| > |0|SUSPENDED (curator has been disconnected from zookeeper)| > |40|LOST (curator is still disconnected, it must have been lost the sesio= n as it is disconnected for 40sec)| > Given this scenario we could ,theoretically, ignore the SUSPENDED event a= nd consider the leadership as lost just if the ConnectionStateListener rece= ives the LOST event. > But this feature seems to have introduced a bug (from my point of view) > *Case of failure* > ||Time (seconds)||Event|| > |0|Something went wrong with the connected zookeeper (in my case, the net= work inteface of zookeeper's server has gone down). Curator stops hearing h= eart beats from zookeeper, but doesn't lose the connection (from some reaso= n that I don't know, if the network interface of the server goes down, Cura= tor doesn't lose the connection)| > |~26.666|SUSPENDED (after 26 seconds without hearing heartbeats, curator = emits a SUSPENDED event) 26 is from "readTimeout =3D sessionTimeout * 2 / 3= " from the class ClientCnxn.java from zookeeper client. At this point, cura= tor starts counting 40 sec.| > |26.666 to 40|During this period, Curator is trying to connect to other z= ookeeper instances but the other instances, in my example case, are also un= cheachable.| > |40|Session has expired and the other instance has taken leadership ( in = my example, the other instance can connect to zookeeper )| > |66.666|LOST ( after 40sec from SUSPENDED, curator finally sends LOST)| > As you can see, if we are ignoring the SUSPENDED event, the second applic= ation instance acquires the leadership ~26 seconds before the first instanc= e notice that it lost the leadership. > I understand it seems to be a very rare case, but either way I think it = should be addressed. > *Reproduce it* > I have came up with a way to reproduce this easily. I know this is not a = recommended production setup, but it reproduces the problem anyway. > 1) On a virtual machine, with 2 network interfaces (eth0[192.168.0.101], = eth1[192.168.0.102]) , I installed one zookeeper instance. > 2) I setup application1 with the leadership receipe, with 40sec of negot= iated timeout, pointing just to 192.168.0.101=C2=A0 .Now it is the leader > 3) I setup application2 with the leadership receipe, with 40sec of negot= iated timeout, pointing just to 192.168.0.102=C2=A0 .Now it it is NOT the l= eader > 4) On the server I turn the eth0[192.168.0.101] interface down=C2=A0 [ i= fconfig eth0 down ] > 5) After 26 seconds, application1 says :=20 > =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 :ClientCnxn$SendThread@1111= ] - Client session timed out, have not heard from server in 26679ms for ses= sionid > =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 ConnectionStateManage= r@237] - State change: SUSPENDED > =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0NOTE: I'm ignoring the SUSPENDED ev= ent > 6) After 40 seconds, application2 takes leadership > 7) After 66 seconds, application1 says : > =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0ConnectionState= Manager@237] - State change: LOST > =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0 > =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0NOTE: Just at this point, I consid= er that the application1 has lost leadership > Then, for 26 seconds, we had 2 leaders. > If you confirm it as a bug, I think I could help. -- This message was sent by Atlassian JIRA (v7.6.3#76005)