Return-Path: X-Original-To: apmail-zookeeper-user-archive@www.apache.org Delivered-To: apmail-zookeeper-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id F279D114C6 for ; Tue, 2 Sep 2014 07:25:32 +0000 (UTC) Received: (qmail 74475 invoked by uid 500); 2 Sep 2014 07:25:31 -0000 Delivered-To: apmail-zookeeper-user-archive@zookeeper.apache.org Received: (qmail 74431 invoked by uid 500); 2 Sep 2014 07:25:31 -0000 Mailing-List: contact user-help@zookeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@zookeeper.apache.org Delivered-To: mailing list user@zookeeper.apache.org Received: (qmail 74417 invoked by uid 99); 2 Sep 2014 07:25:31 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Sep 2014 07:25:31 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of sslavic@gmail.com designates 74.125.82.50 as permitted sender) Received: from [74.125.82.50] (HELO mail-wg0-f50.google.com) (74.125.82.50) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Sep 2014 07:25:05 +0000 Received: by mail-wg0-f50.google.com with SMTP id x12so6296298wgg.21 for ; Tue, 02 Sep 2014 00:25:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=H9E7mlF4LwakSI1NWcF864Hfpvmmyc+oNUeq2WVI1y4=; b=uXk55uoaIy6oC9MRveguR7EJKdMrOM14fuCofkuj1iGpytb1TpunPPinDLRHMBRbuC looIQLLbPxpAoXqLfOhYgzP6yFPSzq8H9lCsrhgmCM8jB88Sj7jzgfVSJycVriaFFuxi Lrrv+dzv9zONr84nC6L6BWbQk7+Cn2b/J+cjhaj2479KhqbR1ElsLuHMsy8VJBRTN8rF KG++XRtiQGC4qXiG5x0rHOHWBPhEEuKMxFNix52kSoMt1IHnvOTwYnFfbFopfzDSTU+5 Azv56a1kRTQBeKmEpwDqhlOPo2mksZ2r+8SQPlpjXvcVKFFdysDPQkgV1EQoaVTkweSj V0dQ== MIME-Version: 1.0 X-Received: by 10.180.210.163 with SMTP id mv3mr26851519wic.15.1409642705003; Tue, 02 Sep 2014 00:25:05 -0700 (PDT) Received: by 10.194.46.195 with HTTP; Tue, 2 Sep 2014 00:25:04 -0700 (PDT) In-Reply-To: References: Date: Tue, 2 Sep 2014 09:25:04 +0200 Message-ID: Subject: Re: ServerCnxnFactory startup order and registering ZooKeeperServer JMX MBean From: =?UTF-8?Q?Stevo_Slavi=C4=87?= To: Rakesh R Cc: "user@zookeeper.apache.org" Content-Type: multipart/alternative; boundary=001a11c348f0b12d690502100472 X-Virus-Checked: Checked by ClamAV on apache.org --001a11c348f0b12d690502100472 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hello Rakesh, Thanks for fast response! I've created a ticket and submitted a patch: https://issues.apache.org/jira/browse/ZOOKEEPER-2026 Kind regards, Stevo Slavic. On Tue, Sep 2, 2014 at 7:30 AM, Rakesh R wrote: > Hi Stevo Slavic, > > Yes, its very nice observation. I think this has to be corrected. > > Could you raise a JIRA ticket and add these details in that for further > discussion. > > Regards, > Rakesh > > -----Original Message----- > From: Stevo Slavi=C4=87 [mailto:sslavic@gmail.com] > Sent: 02 September 2014 03:08 > To: user@zookeeper.apache.org > Subject: ServerCnxnFactory startup order and registering ZooKeeperServer > JMX MBean > > Hello ZooKeeper community, > > When running ZK (3.4.6) related tests in parallel in same JVM, multiple > servers although assigned a different local port clash when trying to > register JMX MBean for server (see [1]) - the two get assigned same MBean > name. Registering JMX MBean for ZooKeeperServer it seems cannot be > disabled, not even for tests. > > Looking into ZooKeeperServerBean constructor, and > ZooKeeperServer.getClientPort one can see that the MBean name will clash > only when server connection factory is not bound to server, before startu= p > method of server connection factory gets called. > This is exactly what happens in startup methods of both > NIOServerCnxnFactory and NettyServerCnxnFactory, because of IMO wrong ord= er > that the methods are being called. Instead of current [2] IMO it should b= e > [3] or at least [4]. > > Is my understanding wrong? If not, is this a (known) bug? > > Kind regards, > Stevo Slavic > > > [1] example build output fragment with failing ZK server JMX MBean > registration > javax.management.InstanceAlreadyExistsException: > org.apache.ZooKeeperService:name0=3DStandaloneServer_port-1 > at com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:43= 7) > at > > com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerWithReposit= ory(DefaultMBeanServerInterceptor.java:1898) > at > > com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBea= n(DefaultMBeanServerInterceptor.java:966) > at > > com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(Defa= ultMBeanServerInterceptor.java:900) > at > > com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(Defau= ltMBeanServerInterceptor.java:324) > at > > com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:= 522) > at > org.apache.zookeeper.jmx.MBeanRegistry.register(MBeanRegistry.java:96) > at > > org.apache.zookeeper.server.ZooKeeperServer.registerJMX(ZooKeeperServer.j= ava:377) > at > > org.apache.zookeeper.server.ZooKeeperServer.startup(ZooKeeperServer.java:= 410) > at > > org.apache.zookeeper.server.NIOServerCnxnFactory.startup(NIOServerCnxnFac= tory.java:123) > > > > [2] > @Override > public void startup(ZooKeeperServer zks) throws IOException, > InterruptedException { > start(); > zks.startdata(); > zks.startup(); > setZooKeeperServer(zks); > } > > [3] > @Override > public void startup(ZooKeeperServer zks) throws IOException, > InterruptedException { > start(); > setZooKeeperServer(zks); > zks.startdata(); > zks.startup(); > } > > [4] > @Override > public void startup(ZooKeeperServer zks) throws IOException, > InterruptedException { > start(); > zks.startdata(); > setZooKeeperServer(zks); > zks.startup(); > } > --001a11c348f0b12d690502100472--