vznet/mongo-jackson-mapper — Issue #6: EOFException when querying for a document with byte[]
Author: criedel
Created: 2012-01-01 22:27:32+00:00
State: open

I'm having a collection with lots of binary data in it. When looking for existing documents the query I wrote fails for some documents. And when it fails it always fails for the same document. I wasn't really able to track down the exact cause so I wrote a test case that adds one file a lot of times to a random collection and performs a query that is pretty identical to the one I use in my code.
It's kind of brute force but it seems to work (currently a few times in a row, so I'm confident you can see the same error).
When I'm debugging the line that throws the EOFException in LittleEndianInputStream.java I can reproduce the error every time.

The test case produces this output on my local computer and my build server:
(unfortunately I committed it under #5)

```
Running net.vz.mongodb.jackson.TestParsingAndGenerating
Jan 1, 2012 11:16:19 PM com.mongodb.DBPortPool gotError
WARNING: emptying DBPortPool to 127.0.0.1:27017 b/c of error
java.io.EOFException
at de.undercouch.bson4jackson.io.LittleEndianInputStream.readFully(LittleEndianInputStream.java:116)
at de.undercouch.bson4jackson.io.LittleEndianInputStream.readFully(LittleEndianInputStream.java:108)
at de.undercouch.bson4jackson.BsonParser.handleBinary(BsonParser.java:388)
at de.undercouch.bson4jackson.BsonParser.nextToken(BsonParser.java:241)
at org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:693)
at org.codehaus.jackson.map.deser.BeanDeserializer.deserialize(BeanDeserializer.java:580)
at org.codehaus.jackson.map.ObjectMapper._readValue(ObjectMapper.java:2695)
at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1308)
at net.vz.mongodb.jackson.internal.stream.JacksonDBDecoder.decode(JacksonDBDecoder.java:62)
at com.mongodb.Response.(Response.java:66)
at com.mongodb.DBPort.go(DBPort.java:128)
at com.mongodb.DBPort.call(DBPort.java:79)
at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:218)
at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:305)
at com.mongodb.DBCursor._check(DBCursor.java:369)
at com.mongodb.DBCursor._hasNext(DBCursor.java:498)
at com.mongodb.DBCursor.hasNext(DBCursor.java:523)
at net.vz.mongodb.jackson.DBCursor.hasNext(DBCursor.java:315)
at net.vz.mongodb.jackson.TestParsingAndGenerating.testHugeData(TestParsingAndGenerating.java:313)
```