|
Whoops. I don't think it's 2.1 but it must be 2.2.
I'll try and reproduce this standalone but first I need a way to have readInternal throw an exception. I presume you were using some kind of custom store implementation to do that, I'll see if I can make it happen.under 2.2 and then try the same thing under 2.3.1 to confirm whether it still breaks. Okay I'll eat my words now, it is indeed 2.1 as the version doesn't have openInput(String,int) in it.
Anyway an update: I've managed to reproduce it on any text index by simulating random network outage. I'm keeping a flag which I set to true. The trick is that the wrapping IndexInput implementation randomly throws IOException if the flag is true – if it always throws IOException the problem doesn't occur. If it randomly throws it then it occurs occasionally, and it always seems to be for larger queries (I'm using MatchAllDocsQuery now.) I'll see if I can tweak the code to make it more likely to happen and then start working up to each version of Lucene to see if it stops happening somewhere. I managed to reproduce the problem as-is under version 2.2.
For 2.3 the problem has changed – instead of a NullPointerException it is now an IndexOutOfBoundsException: Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 52, Size: 34 Will attach my test program in a moment. Attaching a test program to reproduce the problem under 2.3.1.
It occurs approximately 1 in every 4 executions for any reasonably large text index (really small ones don't seem to do it so I couldn't attach a text index with it.) The number of fields may be related, looking at the IndexOutOfBoundsException numbers it seems that the indexes we have happen to have a large number of fields. OK indeed I can get the failure to happen, using your Test running against a partial Wikipedia index I have. I'll pursue! Thanks Trejkaz.
Attached patch. All tests pass. I plan to commit in a day or so, to
both trunk (2.4) and 2.3.X branch (2.3.2). I got the failure to happen with a standalone test case, added to I found & fixed the issue. It's in BufferedIndexReader's refill() The fix is simple: use a local "int newLength" and only assign that to I just committed this. Thanks Trejkaz!
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Can you post the index that you are using and the code that results in the 2nd exception? I can't get the 2nd exception to happen in a test case...