title: Hadoop, Mapreduce - Cannot obtain block length for LocatedBlock
body: <p>I've a file on hdfs in the path 'test/test.txt' which is 1.3G</p>
  
  <p>output of ls and du commands is:</p>
  
  <p><code>hadoop fs -du test/test.txt</code> -> <code>1379081672  test/test.txt</code></p>
  
  <p><code>hadoop fs -ls test/test.txt</code> -> </p>
  
  <pre><code>Found 1 items
  -rw-r--r--   3 testuser supergroup 1379081672 2014-05-06 20:27 test/test.txt
  </code></pre>
  
  <p>I want to run a mapreduce job on this file but when i start the mapreduce job on this file the job fails with the following error:</p>
  
  <p><code>hadoop jar myjar.jar test.TestMapReduceDriver test output</code></p>
  
  <pre><code>14/05/29 16:42:03 WARN mapred.JobClient: Use GenericOptionsParser for parsing the 
  arguments. Applications should implement Tool for the same.
  14/05/29 16:42:03 INFO input.FileInputFormat: Total input paths to process : 1
  14/05/29 16:42:03 INFO mapred.JobClient: Running job: job_201405271131_9661
  14/05/29 16:42:04 INFO mapred.JobClient:  map 0% reduce 0%
  14/05/29 16:42:17 INFO mapred.JobClient: Task Id : attempt_201405271131_9661_m_000004_0, Status : FAILED
  java.io.IOException: Cannot obtain block length for LocatedBlock{BP-428948818-namenode-1392736828725:blk_-6790192659948575136_8493225; getBlockSize()=36904392; corrupt=false; offset=1342177280; locs=[datanode4:50010, datanode3:50010, datanode1:50010]}
  at org.apache.hadoop.hdfs.DFSInputStream.readBlockLength(DFSInputStream.java:319)
  at org.apache.hadoop.hdfs.DFSInputStream.fetchLocatedBlocksAndGetLastBlockLength(DFSInputStream.java:263)
  at org.apache.hadoop.hdfs.DFSInputStream.openInfo(DFSInputStream.java:205)
  at org.apache.hadoop.hdfs.DFSInputStream.&lt;init&gt;(DFSInputStream.java:198)
  at org.apache.hadoop.hdfs.DFSClient.open(DFSClient.java:1117)
  at org.apache.hadoop.hdfs.DistributedFileSystem.open(DistributedFileSystem.java:249)
  at org.apache.hadoop.hdfs.DistributedFileSystem.open(DistributedFileSystem.java:82)
  at org.apache.hadoop.fs.FileSystem.open(FileSystem.java:746)
  at org.apache.hadoop.mapreduce.lib.input.LineRecordReader.initialize(LineRecordReader.java:83)
  at org.apache.hadoop.mapred.Ma`
  </code></pre>
  
  <p>i tried the following commands: </p>
  
  <p><code>hadoop fs -cat test/test.txt</code> gives the following error</p>
  
  <pre><code>cat: Cannot obtain block length for LocatedBlock{BP-428948818-10.17.56.16-1392736828725:blk_-6790192659948575136_8493225; getBlockSize()=36904392; corrupt=false; offset=1342177280; locs=[datanode3:50010, datanode1:50010, datanode4:50010]}
  </code></pre>
  
  <p>additionally i can't copy the file <code>hadoop fs -cp test/test.txt tmp</code> gives same error:</p>
  
  <pre><code>cp: Cannot obtain block length for LocatedBlock{BP-428948818-10.17.56.16-1392736828725:blk_-6790192659948575136_8493225; getBlockSize()=36904392; corrupt=false; offset=1342177280; locs=[datanode1:50010, datanode3:50010, datanode4:50010]}
  </code></pre>
  
  <p>output of the <code>hdfs fsck /user/testuser/test/test.txt</code> command:</p>
  
  <pre><code>Connecting to namenode via `http://namenode:50070`
  FSCK started by testuser (auth:SIMPLE) from /10.17.56.16 for path 
  /user/testuser/test/test.txt at Thu May 29 17:00:44 EEST 2014
  Status: HEALTHY
  Total size: 0 B (Total open files size: 1379081672 B)
  Total dirs: 0
  Total files:    0 (Files currently being written: 1)
  Total blocks (validated):   0 (Total open file blocks (not validated): 21)
  Minimally replicated blocks:    0
  Over-replicated blocks: 0
  Under-replicated blocks:    0
  Mis-replicated blocks:      0
  Default replication factor: 3
  Average block replication:  0.0
  Corrupt blocks:     0
  Missing replicas:       0
  Number of data-nodes:       5
  Number of racks:        1
  FSCK ended at Thu May 29 17:00:44 EEST 2014 in 0 milliseconds
  The filesystem under path /user/testuser/test/test.txt is HEALTHY
  </code></pre>
  
  <p>by the way i can see the content of the test.txt file from the web browser.</p>
  
  <p>hadoop version is: Hadoop 2.0.0-cdh4.5.0</p>