From dev-return-72166-archive-asf-public=cust-asf.ponee.io@zookeeper.apache.org Tue Aug 7 16:59:04 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 8DAA7180657 for ; Tue, 7 Aug 2018 16:59:03 +0200 (CEST) Received: (qmail 587 invoked by uid 500); 7 Aug 2018 14:59:02 -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 571 invoked by uid 99); 7 Aug 2018 14:59:02 -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; Tue, 07 Aug 2018 14:59:02 +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 38492CB283 for ; Tue, 7 Aug 2018 14:59:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -110.301 X-Spam-Level: X-Spam-Status: No, score=-110.301 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, 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-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 bvhaHdj_6fN3 for ; Tue, 7 Aug 2018 14:59:01 +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 431E25F41B for ; Tue, 7 Aug 2018 14:59: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 8EA84E0D27 for ; Tue, 7 Aug 2018 14:59: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 5570323F99 for ; Tue, 7 Aug 2018 14:59:00 +0000 (UTC) Date: Tue, 7 Aug 2018 14:59:00 +0000 (UTC) From: "Andor Molnar (JIRA)" To: dev@zookeeper.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (ZOOKEEPER-3113) EphemeralType.get() fails to verify ephemeralOwner when currentElapsedTime() is smaller than 0xffffff MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Andor Molnar created ZOOKEEPER-3113: --------------------------------------- Summary: EphemeralType.get() fails to verify ephemeralOwner wh= en currentElapsedTime() is smaller than 0xffffff Key: ZOOKEEPER-3113 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-3113 Project: ZooKeeper Issue Type: Bug Components: server Affects Versions: 3.5.4, 3.6.0 Reporter: Andor Molnar EphemeralTypeTest.testServerIds() unit test fails on some systems that Syst= em.nanoTime() is smaller than a certain value. The test=C2=A0generates ephemeralOwner in the old way (pre ZOOKEEPER-2901) = without enabling the emulation flag and asserts for exception to be thrown = when serverId =3D=3D 255. This is right. ZooKeeper should fail on this case= , because serverId cannot be larger than 254 if extended types are enabled.= In this case ephemeralOwner=C2=A0with 0xff in the most significant byte in= dicates an extended type. The logic which does the validation is in EphemeralType.get(). It checks 2 things: * the extended type byte is set: 0xff, * reserved bits (next 2 bytes) corresponds to a valid extended type. Here is the problem: currently we only have 1 extended type: TTL with value= of 0x0000 in the reserved bits. Logic expects that if we have anything different from it in the reserved bi= ts, the ephemeralOwner is invalid and exception should be thrown. That's wh= at the test asserts for and it works on most systems, because the timestamp= part of the sessionId usually have some bits in the reserved bits as well = which eventually will be larger than 0, so the value is unsupported. I think the problem is twofold: * Either if we have more extended types, we'll increase the possibility th= at this logic will accept invalid sessionIds (as long as reserved bits indi= cate a valid extended type), * Or (which happens on some systems) if the currentElapsedTime (timestamp = part of sessionId) is small enough and doesn't occupy reserved bits, this l= ogic will accept the invalid sessionId. Unfortunately I cannot repro the problem yet: it constantly happens on a sp= ecific Jenkins slave, but even with the same distro and same JDK version I = cannot reproduce the same nanoTime() values. -- This message was sent by Atlassian JIRA (v7.6.3#76005)