hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Vimont (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-15835) HBaseTestingUtility#startMiniCluster throws "HMasterAddress already in use" RuntimeException when a local instance of HBase is running
Date Mon, 20 Jun 2016 01:30:05 GMT

    [ https://issues.apache.org/jira/browse/HBASE-15835?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15338871#comment-15338871

Daniel Vimont commented on HBASE-15835:

No problem -- this can certainly wait until 1.3.1! But I'm very appreciative that you're getting
HBASE-14877 and HBASE-14878 into 1.3!!

And when it gets time for 1.3.1, the most straightforward thing to do might be to only backport
the modifications in HBaseTestingUtility.java and TestHBaseTestingUtility.java, and simply
rip out all the other Test* module changes that are there (in the HBASE-15835-v3.patch file).
While it was a good idea to get that extraneous port-setting code out of the ongoing master
branch (since existing code tends to be used as a model for new code added in the future),
it's likely a lot less important to remove it from the 1.x branches.

> 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
>            Assignee: Daniel Vimont
>              Labels: easyfix
>             Fix For: 2.0.0, 1.4.0, 1.3.1
>         Attachments: HBASE-15835-v1.patch, HBASE-15835-v2.patch, HBASE-15835-v3.patch
> 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
> {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

View raw message