[ 
https://issues.apache.org/jira/browse/HIVE-1829?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12977703#action_12977703
 ] 

Carl Steinbach commented on HIVE-1829:
--------------------------------------

Ashutosh's hunch is right -- this doesn't have anything to do with multiple IPs.

The problem is caused by the setUp method in TestRemoteHiveMetaStore:

{code:java}
  protected void setUp() throws Exception {
    super.setUp();
    if(isServerRunning) {
      return;
    }
    Thread t = new Thread(new RunMS());
    t.start();

    // Wait a little bit for the metastore to start. Should probably have
    // a better way of detecting if the metastore has started?
    Thread.sleep(5000);

    // ...

    client = new HiveMetaStoreClient(hiveConf);
    isThriftClient = true;

    // Now you have the client - run necessary tests.
    isServerRunning = true;
  }
{code}

JUnit calls this method once before running each testcase, and if setUp() 
throws an
exception it will fail the current test before continuing onto the next one.

On slow machines it can take longer than 5 seconds for the MetaStore server 
process
to initialize and open a listening socket (RunMS()). When this happens the
HiveMetaStoreClient constructor fails with an exception that causes setUp to 
exit before
setting isServerRunning to true. JUnit then fails the current testcase and 
immediately begins initializing
the next testcase, which results in another call to setUp(). Since 
isServerRunning is still false
we end up starting another MetaStore server thread which will attempt to open a 
listening
socket on the same port as the first thread, which is what causes the 
TTransportException
that you see in the log above.

> TestRemoteMetaStore fails if machine has multiple IPs
> -----------------------------------------------------
>
>                 Key: HIVE-1829
>                 URL: https://issues.apache.org/jira/browse/HIVE-1829
>             Project: Hive
>          Issue Type: Bug
>          Components: Metastore
>    Affects Versions: 0.6.0
>            Reporter: Edward Capriolo
>
> Notice how Running metastore! appears twice.
> {noformat}
> test:
>     [junit] Running org.apache.hadoop.hive.metastore.TestEmbeddedHiveMetaStore
>     [junit] BR.recoverFromMismatchedToken
>     [junit] Tests run: 11, Failures: 0, Errors: 0, Time elapsed: 36.697 sec
>     [junit] Running org.apache.hadoop.hive.metastore.TestRemoteHiveMetaStore
>     [junit] Running metastore!
>     [junit] Running metastore!
>     [junit] org.apache.thrift.transport.TTransportException: Could not create 
> ServerSocket on address 0.0.0.0/0.0.0.0:29083.
>     [junit]   at 
> org.apache.thrift.transport.TServerSocket.<init>(TServerSocket.java:98)
>     [junit]   at 
> org.apache.thrift.transport.TServerSocket.<init>(TServerSocket.java:79)
>     [junit]   at 
> org.apache.hadoop.hive.metastore.TServerSocketKeepAlive.<init>(TServerSocketKeepAlive.java:34)
>     [junit]   at 
> org.apache.hadoop.hive.metastore.HiveMetaStore.main(HiveMetaStore.java:2189)
>     [junit]   at 
> org.apache.hadoop.hive.metastore.TestRemoteHiveMetaStore$RunMS.run(TestRemoteHiveMetaStore.java:35)
>     [junit]   at java.lang.Thread.run(Thread.java:619)
>     [junit] Running org.apache.hadoop.hive.metastore.TestRemoteHiveMetaStore
>     [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
>     [junit] Test org.apache.hadoop.hive.metastore.TestRemoteHiveMetaStore 
> FAILED (crashed)
> {noformat}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to