I think this is a bug in RAMDirectory?

I can reproduce with the seed, though i modified the test to actually
deal with exceptions correctly (currently its impossible to tell whats
going on).
If you change the directory to anything else (e.g. MMapDirectory,
SimpleFSDirectory), the test passes.

   [junit] Caused by: java.io.IOException: Read past EOF
   [junit]     at
org.apache.lucene.store.RAMInputStream.switchCurrentBuffer(RAMInputStream.java:89)
   [junit]     at
org.apache.lucene.store.RAMInputStream.readBytes(RAMInputStream.java:73)
   [junit]     at
org.apache.lucene.store.DataInput.readString(DataInput.java:118)
   [junit]     at
org.apache.lucene.store.MockIndexInputWrapper.readString(MockIndexInputWrapper.java:141)
   [junit]     at
org.apache.lucene.index.FieldsReader.addField(FieldsReader.java:314)
   [junit]     at
org.apache.lucene.index.FieldsReader.doc(FieldsReader.java:209)
   [junit]     at
org.apache.lucene.index.SegmentReader.document(SegmentReader.java:875)
   [junit]     at
org.apache.lucene.index.DirectoryReader.document(DirectoryReader.java:538)
   [junit]     at
org.apache.lucene.search.TestThreadSafe$Thr.loadDoc(TestThreadSafe.java:68)

Here's my patch to the test, so you get a full exception.

Index: lucene/src/test/org/apache/lucene/search/TestThreadSafe.java
===================================================================
--- lucene/src/test/org/apache/lucene/search/TestThreadSafe.java
 (revision 1056364)
+++ lucene/src/test/org/apache/lucene/search/TestThreadSafe.java
 (working copy)
@@ -34,9 +34,6 @@

   IndexReader ir1;

-  String failure=null;
-
-
   class Thr extends Thread {
     final int iter;
     final Random rand;
@@ -60,9 +57,8 @@
           }

         }
-      } catch (Throwable th) {
-        failure=th.toString();
-        fail(failure);
+      } catch (IOException ex) {
+        throw new RuntimeException(ex);
       }
     }

@@ -131,9 +127,6 @@
     for (int i=0; i<nThreads; i++) {
       tarr[i].join();
     }
-    if (failure!=null) {
-      fail(failure);
-    }
   }

   public void testLazyLoadThreadSafety() throws Exception{
On Fri, Jan 7, 2011 at 10:30 AM, Apache Hudson Server
<[email protected]> wrote:
> Build: https://hudson.apache.org/hudson/job/Lucene-Solr-tests-only-trunk/3501/
>
> 1 tests failed.
> REGRESSION:  org.apache.lucene.search.TestThreadSafe.testLazyLoadThreadSafety
>
> Error Message:
> java.io.IOException: Read past EOF
>
> Stack Trace:
> junit.framework.AssertionFailedError: java.io.IOException: Read past EOF
>        at 
> org.apache.lucene.util.LuceneTestCase$LuceneTestCaseRunner.runChild(LuceneTestCase.java:1111)
>        at 
> org.apache.lucene.util.LuceneTestCase$LuceneTestCaseRunner.runChild(LuceneTestCase.java:1049)
>        at 
> org.apache.lucene.search.TestThreadSafe.doTest(TestThreadSafe.java:135)
>        at 
> org.apache.lucene.search.TestThreadSafe.testLazyLoadThreadSafety(TestThreadSafe.java:148)
>
>
>
>
> Build Log (for compile errors):
> [...truncated 2948 lines...]
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to