Andrew Purtell created HDFS-4744:
------------------------------------
Summary: TestBlockRecovery should bind ephemeral ports redux
Key: HDFS-4744
URL: https://issues.apache.org/jira/browse/HDFS-4744
Project: Hadoop HDFS
Issue Type: Bug
Components: test
Affects Versions: 3.0.0, 2.0.4-alpha
Reporter: Andrew Purtell
Priority: Minor
Occasionally:
{noformat}
java.net.BindException: Port in use: localhost:50070
at org.apache.hadoop.http.HttpServer.openListener(HttpServer.java:730)
at org.apache.hadoop.http.HttpServer.start(HttpServer.java:674)
at
org.apache.hadoop.hdfs.server.namenode.NameNodeHttpServer.start(NameNodeHttpServer.java:157)
at
org.apache.hadoop.hdfs.server.namenode.NameNode.startHttpServer(NameNode.java:552)
at
org.apache.hadoop.hdfs.server.namenode.NameNode.startCommonServices(NameNode.java:485)
at
org.apache.hadoop.hdfs.server.namenode.NameNode.initialize(NameNode.java:448)
at
org.apache.hadoop.hdfs.server.namenode.NameNode.<init>(NameNode.java:609)
at
org.apache.hadoop.hdfs.server.namenode.NameNode.<init>(NameNode.java:594)
at
org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1169)
at
org.apache.hadoop.hdfs.MiniDFSCluster.createNameNode(MiniDFSCluster.java:893)
at
org.apache.hadoop.hdfs.MiniDFSCluster.createNameNodesAndSetConf(MiniDFSCluster.java:784)
at
org.apache.hadoop.hdfs.MiniDFSCluster.initMiniDFSCluster(MiniDFSCluster.java:642)
at org.apache.hadoop.hdfs.MiniDFSCluster.<init>(MiniDFSCluster.java:334)
at org.apache.hadoop.hdfs.MiniDFSCluster.<init>(MiniDFSCluster.java:115)
at
org.apache.hadoop.hdfs.MiniDFSCluster$Builder.build(MiniDFSCluster.java:316)
at
org.apache.hadoop.hdfs.server.datanode.TestBlockRecovery.testRaceBetweenReplicaRecoveryAndFinalizeBlock(TestBlockRecovery.java:581)
{noformat}
This fixes the problem, tested with nc processes bound to 8020 and 50070:
{noformat}
diff --git
a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/Te
index a400e85..a990a54 100644
---
a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestBlock
+++
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestBlock
@@ -579,7 +579,6 @@ public void
testRaceBetweenReplicaRecoveryAndFinalizeBlock() throws Exception {
Configuration conf = new HdfsConfiguration();
MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf)
- .nnTopology(MiniDFSNNTopology.simpleSingleNN(8020, 50070))
.numDataNodes(1).build();
try {
cluster.waitClusterUp();
{noformat}
Also, this is a problem:
{code}
private final static InetSocketAddress NN_ADDR = new InetSocketAddress(
"localhost", 5020);
{code}
Two instances of this test can't run simultaneously on the same host and may
not work at all if port 5020 is bound by something else.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira