[ 
https://issues.apache.org/jira/browse/HDFS-4344?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13562224#comment-13562224
 ] 

Andy Isaacson commented on HDFS-4344:
-------------------------------------

bq. Most of the constants at the top of TestHostsFiles seem to be unused. 
Perhaps this was copied from somewhere else?

Yes, it was copied from another test, and I looked for eclipse squiggles but 
since the constants are public Eclipse didn't mark them as unused. Thanks for 
noticing!

bq. Is it actually necessary to configure multiple racks, write a file, 
decommission a host, etc. to trigger this bug? From my understanding of the 
bug, I thought just the mere presence of the port in the file would trigger an 
error on the NN web UI.

Just the trivial setup doesn't trigger the failure because we don't hit the 
parsing code in the simple case. We need a DN that has checked in and then 
failed to check in, if I remember the repro conditions correctly.
                
> dfshealth.jsp throws NumberFormatException when dfs.hosts/dfs.hosts.exclude 
> includes port number
> ------------------------------------------------------------------------------------------------
>
>                 Key: HDFS-4344
>                 URL: https://issues.apache.org/jira/browse/HDFS-4344
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: namenode
>    Affects Versions: 3.0.0, 2.0.2-alpha
>            Reporter: tamtam180
>            Assignee: Andy Isaacson
>         Attachments: hdfs4344.txt
>
>
> dfs.hosts and dfs.hosts.exclude files cannot contain a port number of host.
> If contained, and access a dfshealth.jsp on a webui, we got a 
> NumberFormatException.
> How to reproduce:
> {noformat}
> $ cat /tmp/include.txt
> salve-host1:9999
> $ cat /tmp/exclude.txt
> slave-host1:9999
> $ hdfs namenode -Ddfs.hosts=/tmp/include.txt 
> -Ddfs.hosts.exclude=/tmp/exclude.txt
> {noformat}
> Error:
> {noformat}
> Problem accessing /dfshealth.jsp. Reason:
>     For input string: ":9999"
> Caused by:
> java.lang.NumberFormatException: For input string: ":9999"
>      at 
> java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
>      at java.lang.Integer.parseInt(Integer.java:449)
>      at java.lang.Integer.valueOf(Integer.java:554)
>      at 
> org.apache.hadoop.hdfs.server.blockmanagement.DatanodeManager.parseDNFromHostsEntry(DatanodeManager.java:970)
>      at 
> org.apache.hadoop.hdfs.server.blockmanagement.DatanodeManager.getDatanodeListForReport(DatanodeManager.java:1039)
>      at 
> org.apache.hadoop.hdfs.server.blockmanagement.DatanodeManager.fetchDatanodes(DatanodeManager.java:892)
>      at 
> org.apache.hadoop.hdfs.server.namenode.NamenodeJspHelper$HealthJsp.generateHealthReport(NamenodeJspHelper.java:288)
>      at 
> org.apache.hadoop.hdfs.server.namenode.dfshealth_jsp._jspService(dfshealth_jsp.java:109)
>      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
>      at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
>      at 
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1221)
>      at 
> org.apache.hadoop.http.lib.StaticUserWebFilter$StaticUserFilter.doFilter(StaticUserWebFilter.java:109)
>      at 
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
>      at 
> org.apache.hadoop.http.HttpServer$QuotingInputFilter.doFilter(HttpServer.java:1071)
>      at 
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
>      at org.apache.hadoop.http.NoCacheFilter.doFilter(NoCacheFilter.java:45)
>      at 
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
>      at org.apache.hadoop.http.NoCacheFilter.doFilter(NoCacheFilter.java:45)
>      at 
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
>      at 
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
>      at 
> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
>      at 
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
>      at 
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
>      at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
>      at 
> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
>      at 
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>      at org.mortbay.jetty.Server.handle(Server.java:326)
>      at 
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
>      at 
> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928)
>      at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
>      at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
>      at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
>      at 
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
>      at 
> org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
> {noformat}
> It's probably because DatanodeManager.parseDNFromHostsEntry() doesn't parse 
> host:port string correctly.
> {noformat}
>   private DatanodeID parseDNFromHostsEntry(String hostLine) {
>     DatanodeID dnId;
>     String hostStr;
>     int port;
>     int idx = hostLine.indexOf(':');
>     if (-1 == idx) {
>       hostStr = hostLine;
>       port = DFSConfigKeys.DFS_DATANODE_DEFAULT_PORT;
>     } else {
>       hostStr = hostLine.substring(0, idx);
>       port = Integer.valueOf(hostLine.substring(idx)); // <- HERE!!
>     }
> {noformat}
> correct it as the below.
> {noformat}
> port = Integer.valueOf(hostLine.substring(idx + 1));
> {noformat}

--
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

Reply via email to