# EOFException while reading SequenceFile to restore ES

**URL:** https://discuss.elastic.co/t/eofexception-while-reading-sequencefile-to-restore-es/38172
**Category:** Elasticsearch
**Tags:** es-hadoop
**Created:** [December 30, 2015, 12:25pm UTC](https://discuss.elastic.co/t/eofexception-while-reading-sequencefile-to-restore-es/38172 "2015-12-30T12:25:15Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Aurelien\_3](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@Aurelien\_3](https://discuss.elastic.co/u/Aurelien_3)
#### Post date: [December 30, 2015, 12:25pm UTC](https://discuss.elastic.co/t/eofexception-while-reading-sequencefile-to-restore-es/38172/1 "2015-12-30T12:25:15Z")

</div>

Hi,

I've been trying to backup an ES cluster and restore it using Hadoop and the hadoop ES library. I'm using ES 1.7.1.

Because of the size of data and network speed, I did bucket the operation by date ranges. For some buckets, everything is working fine.

But for some buckets, I can't restore the data into ES. I get this error on the sequence files reading :

`  
2015-12-30 11:43:31,202 INFO [main] org.apache.hadoop.mapred.MapTask: Processing split: hdfs://.../2014/7/part-m-00011:0+134217728  
2015-12-30 11:43:35,435 INFO [main] org.apache.hadoop.mapred.MapTask: (EQUATOR) 0 kvi 300417020(1201668080)  
2015-12-30 11:43:35,435 INFO [main] org.apache.hadoop.mapred.MapTask: mapreduce.task.io.sort.mb: 1146  
2015-12-30 11:43:35,435 INFO [main] org.apache.hadoop.mapred.MapTask: soft limit at 841167680  
2015-12-30 11:43:35,435 INFO [main] org.apache.hadoop.mapred.MapTask: bufstart = 0; bufvoid = 1201668096  
2015-12-30 11:43:35,435 INFO [main] org.apache.hadoop.mapred.MapTask: kvstart = 300417020; length = 75104256  
2015-12-30 11:43:35,448 INFO [main] org.apache.hadoop.mapred.MapTask: Map output collector class = org.apache.hadoop.mapred.MapTask$MapOutputBuffer  
2015-12-30 11:43:35,904 INFO [main] org.apache.hadoop.mapred.MapTask: Starting flush of map output  
2015-12-30 11:43:35,905 INFO [main] org.apache.hadoop.mapred.MapTask: Spilling map output  
2015-12-30 11:43:35,905 INFO [main] org.apache.hadoop.mapred.MapTask: bufstart = 0; bufend = 106017; bufvoid = 1201668096  
2015-12-30 11:43:35,905 INFO [main] org.apache.hadoop.mapred.MapTask: kvstart = 300417020(1201668080); kvend = 300417016(1201668064); length = 5/75104256  
2015-12-30 11:43:35,912 INFO [main] org.apache.hadoop.mapred.MapTask: Finished spill 0  
2015-12-30 11:43:35,921 WARN [main] org.apache.hadoop.mapred.YarnChild: Exception running child : java.io.EOFException  
at java.io.DataInputStream.readFully(DataInputStream.java:197)  
at org.apache.hadoop.io.Text.readWithKnownLength(Text.java:319)  
at org.apache.hadoop.io.Text.readFields(Text.java:291)  
at org.apache.hadoop.io.ArrayWritable.readFields(ArrayWritable.java:96)  
at org.elasticsearch.hadoop.mr.WritableArrayWritable.readFields(WritableArrayWritable.java:54)  
at org.apache.hadoop.io.MapWritable.readFields(MapWritable.java:188)  
at org.apache.hadoop.io.serializer.WritableSerialization$WritableDeserializer.deserialize(WritableSerialization.java:71)  
at org.apache.hadoop.io.serializer.WritableSerialization$WritableDeserializer.deserialize(WritableSerialization.java:42)  
at org.apache.hadoop.io.SequenceFile$Reader.deserializeValue(SequenceFile.java:2247)  
at org.apache.hadoop.io.SequenceFile$Reader.getCurrentValue(SequenceFile.java:2220)  
at org.apache.hadoop.mapreduce.lib.input.SequenceFileRecordReader.nextKeyValue(SequenceFileRecordReader.java:78)  
at org.apache.hadoop.mapred.MapTask$NewTrackingRecordReader.nextKeyValue(MapTask.java:556)  
at org.apache.hadoop.mapreduce.task.MapContextImpl.nextKeyValue(MapContextImpl.java:80)  
at org.apache.hadoop.mapreduce.lib.map.WrappedMapper$Context.nextKeyValue(WrappedMapper.java:91)  
at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:145)  
at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:787)  
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)  
at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:164)  
at java.security.AccessController.doPrivileged(Native Method)  
at javax.security.auth.Subject.doAs(Subject.java:422)  
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1657)  
at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)

2015-12-30 11:43:35,925 INFO [main] org.apache.hadoop.mapred.Task: Runnning cleanup for the task  
`

The odd thing, is that it occurs always on the same files. I suspect that the files are somehow corrupted, but I don't understand, how to repair (best solution fo course) or bypass.

Does anyone has a clue on this ?

BR,  
Aurelien

---

<div class="post-metadata">

### Author: ![krisgeus](https://avatars.discourse-cdn.com/v4/letter/k/45deac/32.png) [@krisgeus](https://discuss.elastic.co/u/krisgeus)
#### Post date: [December 31, 2015, 7:37am UTC](https://discuss.elastic.co/t/eofexception-while-reading-sequencefile-to-restore-es/38172/2 "2015-12-31T07:37:37Z")

</div>

I've seen this recently with a sequence file which was exactly 128MB (same as blocksize). Could you verify that this is the case with the specific file you mention?

---

<div class="post-metadata">

### Author: ![Aurelien\_3](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@Aurelien\_3](https://discuss.elastic.co/u/Aurelien_3)
#### Post date: [December 31, 2015, 9:20am UTC](https://discuss.elastic.co/t/eofexception-while-reading-sequencefile-to-restore-es/38172/3 "2015-12-31T09:20:00Z")

</div>

Hi Kris,

Thank you for the idea, but no ! All the failing files are of different size ranging from 20MB to 230MB.

At first I was thinking that my entries were somehow too big and so, it was failing on the last entry.  
But according to specification, a mapper will read the sequence file until it finds the end of entry and will bypass the block cuts to read correctly each entry.

Aurelien

---

<div class="post-metadata">

### Author: ![costin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/costin/32/44950_2.png) [@costin](https://discuss.elastic.co/u/costin)
#### Post date: [December 31, 2015, 3:29pm UTC](https://discuss.elastic.co/t/eofexception-while-reading-sequencefile-to-restore-es/38172/4 "2015-12-31T15:29:40Z")

</div>

Reparing data in HDFS is a bit of black magic since due to the replication (by default 3) it should not occur in the first place. My advice is to first back it up and try to check it and see whether something sticks out.  
Then do the typical 'reboot' - delete it and add it again; this should refresh the namenode at least.  
You could also try checking the low HDFS infrastructure and check whether all the copies/replicas are the same or not.

Unfortunately the problem is Hadoop specific so you might get more information from your distro forums then here.

---

<div class="post-metadata">

### Author: ![Aurelien\_3](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@Aurelien\_3](https://discuss.elastic.co/u/Aurelien_3)
#### Post date: [January 8, 2016, 10:49am UTC](https://discuss.elastic.co/t/eofexception-while-reading-sequencefile-to-restore-es/38172/5 "2016-01-08T10:49:22Z")

</div>

Thanks for the ideas. I'm digging into this.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 6, 2017, 1:26pm UTC](https://discuss.elastic.co/t/eofexception-while-reading-sequencefile-to-restore-es/38172/6 "2017-07-06T13:26:45Z")

</div>


