From dev-return-73464-archive-asf-public=cust-asf.ponee.io@zookeeper.apache.org Fri Sep 21 16:22:07 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 74A3B18067C for ; Fri, 21 Sep 2018 16:22:06 +0200 (CEST) Received: (qmail 29872 invoked by uid 500); 21 Sep 2018 14:22:05 -0000 Mailing-List: contact dev-help@zookeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@zookeeper.apache.org Delivered-To: mailing list dev@zookeeper.apache.org Received: (qmail 29679 invoked by uid 99); 21 Sep 2018 14:22:05 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Sep 2018 14:22:05 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id EC0A21855AE for ; Fri, 21 Sep 2018 14:22:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.501 X-Spam-Level: X-Spam-Status: No, score=-109.501 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id v5i0An7oBl_8 for ; Fri, 21 Sep 2018 14:22:04 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 468105F645 for ; Fri, 21 Sep 2018 14:22:03 +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 8D83AE2638 for ; Fri, 21 Sep 2018 14:22:02 +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 BDC5923F9C for ; Fri, 21 Sep 2018 14:22:01 +0000 (UTC) Date: Fri, 21 Sep 2018 14:22:01 +0000 (UTC) From: "Yun Qin (JIRA)" To: dev@zookeeper.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (ZOOKEEPER-900) FLE implementation should be improved to use non-blocking sockets 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/ZOOKEEPER-900?page=3Dcom.atlass= ian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1= 6623686#comment-16623686 ]=20 Yun Qin commented on ZOOKEEPER-900: ----------------------------------- I believe we have met an issue very similar to what's described in section = b) of the original bug description. In our case, sid 1/2 weren't able to re= join a quorum consisting of sid 3/4/5. The root cause was that QuorumCnxMan= ager$Listener wasn't able to accept connection from sid 1/2 on sid 3/5. Res= tarting ZooKeeper on sid 3/5 solved the issue. I would really appreciate it if we can proceed with the fix, now that we ha= ve a preliminary patch and people willing to take over. Thanks.=C2=A0 > FLE implementation should be improved to use non-blocking sockets > ----------------------------------------------------------------- > > Key: ZOOKEEPER-900 > URL: https://issues.apache.org/jira/browse/ZOOKEEPER-900 > Project: ZooKeeper > Issue Type: Bug > Reporter: Vishal Kher > Assignee: Martin Kuchta > Priority: Critical > Fix For: 3.6.0, 3.5.5 > > Attachments: ZOOKEEPER-900-part2.patch, ZOOKEEPER-900.patch, ZOOK= EEPER-900.patch1, ZOOKEEPER-900.patch2 > > > From earlier email exchanges: > 1. Blocking connects and accepts: > a) The first problem is in manager.toSend(). This invokes connectOne(), w= hich does a blocking connect. While testing, I changed the code so that con= nectOne() starts a new thread called AsyncConnct(). AsyncConnect.run() does= a socketChannel.connect(). After starting AsyncConnect, connectOne starts = a timer. connectOne continues with normal operations if the connection is e= stablished before the timer expires, otherwise, when the timer expires it i= nterrupts AsyncConnect() thread and returns. In this way, I can have an upp= er bound on the amount of time we need to wait for connect to succeed. Of c= ourse, this was a quick fix for my testing. Ideally, we should use Selector= to do non-blocking connects/accepts. I am planning to do that later once w= e at least have a quick fix for the problem and consensus from others for t= he real fix (this problem is big blocker for us). Note that it is OK to do = blocking IO in SenderWorker and RecvWorker threads since they block IO to t= he respective peer. > b) The blocking IO problem is not just restricted to connectOne(), but al= so in receiveConnection(). The Listener thread calls receiveConnection() fo= r each incoming connection request. receiveConnection does blocking IO to g= et peer's info (s.read(msgBuffer)). Worse, it invokes connectOne() back to = the peer that had sent the connection request. All of this is happening fro= m the Listener. In short, if a peer fails after initiating a connection, th= e Listener thread won't be able to accept connections from other peers, bec= ause it would be stuck in read() or connetOne(). Also the code has an inher= ent cycle. initiateConnection() and receiveConnection() will have to be ver= y carefully synchronized otherwise, we could run into deadlocks. This code = is going to be difficult to maintain/modify. > Also see: https://issues.apache.org/jira/browse/ZOOKEEPER-822 -- This message was sent by Atlassian JIRA (v7.6.3#76005)