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 A4F0D2009C6 for ; Mon, 16 May 2016 10:59:29 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id A1BD3160A16; Mon, 16 May 2016 08:59:29 +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 F040D1609B0 for ; Mon, 16 May 2016 10:59:28 +0200 (CEST) Received: (qmail 92098 invoked by uid 500); 16 May 2016 08:59:23 -0000 Mailing-List: contact issues-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@hbase.apache.org Received: (qmail 92083 invoked by uid 99); 16 May 2016 08:59:23 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 May 2016 08:59:23 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id E92932C14E1 for ; Mon, 16 May 2016 08:59:22 +0000 (UTC) Date: Mon, 16 May 2016 08:59:22 +0000 (UTC) From: "Daniel Vimont (JIRA)" To: issues@hbase.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HBASE-15835) HBaseTestingUtility#startMiniCluster throws "HMasterAddress already in use" RuntimeException when a local instance of HBase is running MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 16 May 2016 08:59:29 -0000 [ https://issues.apache.org/jira/browse/HBASE-15835?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15284279#comment-15284279 ] Daniel Vimont commented on HBASE-15835: --------------------------------------- Do the new, stricter spam-prevention settings prevent me (a basic contributor) from assigning this JIRA entry to myself? (I don't seem to be able to do that.) > HBaseTestingUtility#startMiniCluster throws "HMasterAddress already in use" RuntimeException when a local instance of HBase is running > -------------------------------------------------------------------------------------------------------------------------------------- > > Key: HBASE-15835 > URL: https://issues.apache.org/jira/browse/HBASE-15835 > Project: HBase > Issue Type: Bug > Components: API > Affects Versions: 2.0.0 > Reporter: Daniel Vimont > Labels: easyfix > Fix For: 2.0.0 > > > When a MiniCluster is being started with the {{HBaseTestUtility#startMiniCluster}} method (most typically in the context of JUnit testing), if a local HBase instance is already running (or for that matter, another thread with another MiniCluster is already running), the startup will fail with a RuntimeException saying "HMasterAddress already in use", referring explicitly to contention for the same default master info port (16010). > This problem most recently came up in conjunction with HBASE-14876 and its sub-JIRAs (development of new HBase-oriented Maven archetypes), but this is apparently a known issue to veteran developers, who tend to set up the @BeforeClass sections of their test modules with code similar to the following: > {code} > UTIL = HBaseTestingUtility.createLocalHTU(); > // disable UI's on test cluster. > UTIL.getConfiguration().setInt("hbase.master.info.port", -1); > UTIL.getConfiguration().setInt("hbase.regionserver.info.port", -1); > UTIL.startMiniCluster(); > {code} > A comprehensive solution modeled on this should be put directly into HBaseTestUtility's main constructor, using one of the following options: > OPTION 1 (always force random port assignment): > {code} > this.getConfiguration().setInt(HConstants.MASTER_INFO_PORT, -1); > this.getConfiguration().setInt(HConstants.REGIONSERVER_PORT, -1); > {code} > OPTION 2 (always force random port assignment if user has not explicitly defined alternate port): > {code} > Configuration conf = this.getConfiguration(); > if (conf.getInt(HConstants.MASTER_INFO_PORT, HConstants.DEFAULT_MASTER_INFOPORT) > == HConstants.DEFAULT_MASTER_INFOPORT) { > conf.setInt(HConstants.MASTER_INFO_PORT, -1); > } > if (conf.getInt(HConstants.REGIONSERVER_PORT, HConstants.DEFAULT_REGIONSERVER_PORT) > == HConstants.DEFAULT_REGIONSERVER_PORT) { > conf.setInt(HConstants.REGIONSERVER_PORT, -1); > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)