views:

258

answers:

1

Hi,

I am getting java.io.EOFException while reading a binary block from lucene index. I am storing java object as byte-array in lucene index field and reading it when hit occurs.

Here is stack trace :

Caused by: java.io.EOFException at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2281) at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2750) at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:780) at java.io.ObjectInputStream.(ObjectInputStream.java:280) at org.terracotta.modules.searchable.util.SerializationUtil$OIS.(SerializationUtil.java:20)

I have some background threads which write into index. But i buffer them and then write them at once like 1000. Occasionally I also issue optimize() on index. When I write, I am re-opening IndexReader. Does this is happening because of IndexReader re-opening call?

Thanks.

Regards Tushar

A: 

This does not look like it has anything to do directly with lucene. Rather, the exception occurs in the terracotta module. Apparently while it is in the process of serializing, probably serializing your java files. I cannot find the javadocs for this module of terracotta, but it appears to me from the stack trace that the stream length of the streams are incorrectly specified to the serializer.

As Yuval F points out: lucene is not aimed at handling binary content. It is not a storage mechanism and should not be used as such. You cannot rely on getting a correctly serialized version of your bytecode back from lucene.

Steen