[ https://issues.apache.org/jira/browse/HDFS-7553?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14997637#comment-14997637 ]
Xiao Chen commented on HDFS-7553: --------------------------------- I came across the same error: *Error Message* Port in use: localhost:36908 *Stacktrace* {noformat} java.net.BindException: Port in use: localhost:36908 at sun.nio.ch.Net.bind0(Native Method) at sun.nio.ch.Net.bind(Net.java:444) at sun.nio.ch.Net.bind(Net.java:436) at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) at org.mortbay.jetty.nio.SelectChannelConnector.open(SelectChannelConnector.java:216) at org.apache.hadoop.http.HttpServer2.openListeners(HttpServer2.java:939) at org.apache.hadoop.http.HttpServer2.start(HttpServer2.java:880) at org.apache.hadoop.hdfs.server.namenode.NameNodeHttpServer.start(NameNodeHttpServer.java:142) at org.apache.hadoop.hdfs.server.namenode.NameNode.startHttpServer(NameNode.java:754) at org.apache.hadoop.hdfs.server.namenode.NameNode.initialize(NameNode.java:643) at org.apache.hadoop.hdfs.server.namenode.NameNode.<init>(NameNode.java:818) at org.apache.hadoop.hdfs.server.namenode.NameNode.<init>(NameNode.java:797) at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1493) at org.apache.hadoop.hdfs.MiniDFSCluster.restartNameNode(MiniDFSCluster.java:1820) at org.apache.hadoop.hdfs.MiniDFSCluster.restartNameNode(MiniDFSCluster.java:1801) at org.apache.hadoop.hdfs.server.namenode.ha.TestDFSUpgradeWithHA.testRollbackWithNfs(TestDFSUpgradeWithHA.java:593) {noformat} And I agree with [~cnauroth]'s speculation regarding the race condition. Patch 002 added the {{join}} method. I'm having a hard time reproducing the issue though, mainly because of the difficulty of reaching the BindException in jetty, so no unit test added. As a side note, setting {{DFS_NAMENODE_HTTP_ADDRESS_KEY}} at the beginning would not work, because in {{NameNodeHttpServer#start}}, we {{conf.set}} it to the address (including port) of the open connection. So when later in the test where {{cluster.restartNameNode}}, this configuration is read and will be used to start the http server. I feel no change is needed in this test since the RC is on the connection side anyways. > fix the TestDFSUpgradeWithHA due to BindException > ------------------------------------------------- > > Key: HDFS-7553 > URL: https://issues.apache.org/jira/browse/HDFS-7553 > Project: Hadoop HDFS > Issue Type: Test > Components: test > Affects Versions: 2.7.0 > Reporter: Liang Xie > Assignee: Liang Xie > Labels: BB2015-05-TBR > Attachments: HDFS-7553-001.txt > > > see > https://builds.apache.org/job/PreCommit-HDFS-Build/9092//testReport/org.apache.hadoop.hdfs.server.namenode.ha/TestDFSUpgradeWithHA/testNfsUpgrade/ > : > Error Message > Port in use: localhost:57896 > Stacktrace > java.net.BindException: Port in use: localhost:57896 > at sun.nio.ch.Net.bind0(Native Method) > at sun.nio.ch.Net.bind(Net.java:444) > at sun.nio.ch.Net.bind(Net.java:436) > at > sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214) > at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) > at > org.mortbay.jetty.nio.SelectChannelConnector.open(SelectChannelConnector.java:216) > at > org.apache.hadoop.http.HttpServer2.openListeners(HttpServer2.java:868) > at org.apache.hadoop.http.HttpServer2.start(HttpServer2.java:809) > at > org.apache.hadoop.hdfs.server.namenode.NameNodeHttpServer.start(NameNodeHttpServer.java:142) > at > org.apache.hadoop.hdfs.server.namenode.NameNode.startHttpServer(NameNode.java:704) > at > org.apache.hadoop.hdfs.server.namenode.NameNode.initialize(NameNode.java:591) > at > org.apache.hadoop.hdfs.server.namenode.NameNode.<init>(NameNode.java:763) > at > org.apache.hadoop.hdfs.server.namenode.NameNode.<init>(NameNode.java:747) > at > org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1443) > at > org.apache.hadoop.hdfs.MiniDFSCluster.restartNameNode(MiniDFSCluster.java:1815) > at > org.apache.hadoop.hdfs.MiniDFSCluster.restartNameNode(MiniDFSCluster.java:1796) > at > org.apache.hadoop.hdfs.server.namenode.ha.TestDFSUpgradeWithHA.testNfsUpgrade(TestDFSUpgradeWithHA.java:285) -- This message was sent by Atlassian JIRA (v6.3.4#6332)